In all project it’s a real nightmare to manage configuration files. In Silverlight projects like in web application, you can take advantage of Web Application Project Deployment features of Visual Studio 2010. In this blog, I’ll explain you :
In this post, I won’t explain SQL deployment.
The download is available at http://www.iis.net/download/WebDeploy.
You just need to follow the steps to install it.
If you want to install it on a server, you will need to install the “Remote Application Service”.
When you generate the deployment package, you have several files.
All the parameters of the deployment are defined in the web application project. In Visual Studio, open the Properties Panel to update the parameters.
In your build definition, when you compile your solution, you should force MSBuild to use this parameter:
/p:DeployOnBuild=true
In this exemple, I’m using the DefaultTemplate.xaml, I just have to set the parameter in the MSBuild Arguments.
Automatically, the build will deploy in the define drop folder the generated package.
First of all, you need to install the build server the Web Deployment Tool.
After that, in your build, once the build and the tests are completed, for example in the finally of “Try Compile, Test, and Associate Changesets and Work Items” , you can add the code for the deployment.
Create a new sequence for example called Deploy. Create a new variable called DeployCommandFiles with type IEnumerable<String>.
Find the project to deploy using FindMatchingFile Activity and store the result in DeployCommandFiles :
Create a Loop for each element of DeployCommandFiles and each element is a string (variable commandFile).
Excecute the script using InvokeProcess Activity:
This activity will deploy the package on the server using this command line:
<MyProject>.deploy.cmd /t /m:MyServer
Be care full, only administrator of the destination server can deploy application. You should grant admin privileges on the build service account.
Deployment of web application is really easy with Visual Studio 2010. It’s really helpfull to use TFS Build to deploy a web application.
You can also, when the application is deployed, run automated tests (UI Coded tests) to functionally validate the application.