Web application Deployment : Simpler Approach

Digg me

When your project becomes big, deployment becomes very very painful.

If you are copying files manually from Development to Testing and from Testing to Production Server(s) its a nightmare.

I tried the setup project and it was time consuming to configure and make sure you have added all the related references for testing and production.

Finally went to good old DOS command (xCopy – suggested by Microsoft). Initially I was skeptical as it will copy the entire folder structure from development to testing or Production.

After reading more about xCopy realised it has very bunch of handy parameters which does our job exactly the way we wanted it to do.

Create A .bat file say Dev2Test.bat Click here to download file

2. CLS
3. REM /S : Subdirectories
4. REM /Q : Quiet Donot display Filenames
5. REM /R : Overwrites Read Only File
6. REM /Y : Supress Prompting When Overwriting Existing File
7. REM /I : If Destination doesn’t Exist and copying more than One File, its assumed as DIRECTORY.

8. ECHO ‘Processing Local 2 Testing : Complete’
9. ECHO ‘Make sure Testing Server Directory is Mapped as Y:’
10. net use Y: \\yourserver.address

11. ECHO ‘Copying Local To Testing Directory… Please wait …….’

12. XCOPY C:\ProjectFolder Y:\ProjectFolder  /S /Q /R /Y /I  /EXCLUDE:ExcludeList.txt

13. ECHO ‘* * * * * * Copying Completed * * * * * * * *’

Lines 1 – 11 are self explanatory

Line 12 is the one which does the Magic

/Exclude:ExcludeList.txt Click here to download

contains all the extensions and folders which you want to exclude while copying.

One entry per line.

In my Excludelist.txt I have excluded the following files and folders.

.vb  - Code
.scc  - Visual Source Safe
.user  - Visual Source Safe
.vspscc  - Visual Source Safe
.resx  - Resource
.suo  - Visual Source Safe
.config  - web.config file (as it could be different for each environment)
.xml  - If you use GhostDoc for documentation
.sln  - Solution File
.vssscc  - Visual Source Safe
.pdb  - Gets created along with DLL (for production you dont need this)
.myapp  - Visual Studio File
.settings  - Visual Studio File
\My Project - Visual Studio Folder
\obj  - VS Folder
\bin  - As Visual Studio creates \bin for every subproject you create, I want to exclude this too.

I also have another Batch file which copies only the main Bin folder from Development to Testing / Production.

If you use XML Files, or Config Files then separate Batch files will be useful so that things dont get messed up.

Leave a Comment

* Copy This Password *

* Type Or Paste Password Here *