Do you want to use the Cloudy Team Foundation Server, TFSPreview, as Continuous Integration environment with automatic deploy to your own webserver?
Then this short HowTo is for you!
So I guess that since your are here you already have a TFSPreview account setup! If not, go here.
So to set up automatically deployment, you basically need to do two things: Setup your server, so it’s capable to “talk” to the TFS build environment, and configure your buildtemplate, so that MSBuild is supplied with the right arguments. It’s that simple!
Configure your server
1. Logon to your server though a Remote Desktop Connection.
2. Download the Web Platform Installer.
3. Install the Web Deploy 3.0 (Direct download here)
4. Install the IIS Management service, by adding a role service to IIS Role (Server Manager->Roles->Add Role Services):
5. Enable remote connection to the webserver by starting the IIS Manager (shortcut: inetmgr). Click on the servername in the left treeview. Under Mangement in the detail window, double click on the Management Service icon.
Stop the service (to the right, you can stop, start and restart the service). check the “Enable remote connections”, and start the service again:
6. Test the Web Deploy endpoint, by hitting the endpoint: http://[NameOfYourServer]/MSDEPLOYAGENTSERVICE
If it’s successfully set up, you should be prompted for some credentials.
Setting up your VS2012 buildtemplate
Ok, now for the fun part!
1. Connect to your teamsite project. You can do this either by logging in to TFSpreview and go to your teamsite project. There you will find the “Open new instance of Visual Studio”:
Or, fire up Visual studio by yourself, and connect to the teamsite project though the Team Explorer.
2. Well connect, click on the “Builds” link, which will take you the “Builds” screen:
3. Click on the “New Build Definition”.
4. In the General section, give the definition a name
5. The the trigger section,check “Continuous Integration” (If you want a build on each checkin)
6. Select your workspace(s).
7. Configure where to copy the build output.
8. In the Process section, select your solution or your project(s) that you want to build. Tip: If you choose to build a project in a debug configuration, then leave the Platform entry empty in the Configuration section – it will save you from the anoying “The OutputPath property is not set for project ProjectName.csproj’.” error. I.e. set the configuration to “Debug” and leave the platform empty. More on this can be found here.
9. You can leave the rest of the Basic settings as they are unless you have som specific needs.
10. Now for the important parts. In the Advances section, you need to give MSBuild the right arguments:
The arguments are these:
/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:CreatePackageOnPublish=True /p:MSDeployPublishMethod=RemoteAgent /p:MSDeployServiceUrl=http://[NameOfYourServer]/MSDEPLOYAGENTSERVICE /p:DeployIisAppPath=”[IISPath2YourApp]” /p:UserName=[UserName] /p:Password=[Password]
Fill in the your information, and save the Build Definition.
11. Test your build, by right clicking on your build definition, and select “Query new build…” If everything is configured correctly, you should have a deployed project or solution in your designated folder on your webserver. You can double click on the build under “My Builds”, to follow the build process (errors as well!). Voila:-)







