onsdag 6 november 2013

TFS cloud setup with auto-publish to Arvixe

I just finished setting up an CI with TFS in da cloud (tfs.visualstudio.com) with auto-publish to my team's web host. Pheeew!

Well, the first part was quite easy. Setting up a TFS is easy as pie. Just go to http://tfs.visualstudio.com/ and setup your account. I choose Git as version control. There was an easy guide to send your repo to your TFS server. Then there was a good guide to set up a build. But, then the tricky part came when I was going to set up a web deploy to the web host.

The web host is Arvixe and they have a pretty desent hosting environment. To allow Web Deployment you just go to the site's configuration and to the tab "Publishing" and enable. Then you can download the publish profile and import it in Visual Studio 2012. But to make the publishing successful you have to tell the publishing operation to not touch the folder and files permissions. Since you are in a hosting environment you are not admin and are not allowed to do so. This is easy as pie. Follow these instructions from this website:

  1. In the same directory as your project create a file with the name {ProjectName}.wpp.targets (where {ProjectName} is the name of your Web application project)
  2. Inside the file paste the MSBuild content which is below this list
  3. Reload the project in Visual Studio (VS caches the project files in memory so this cache needs to be cleared).
{ProjectName}.wpp.targets
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <IncludeSetAclProviderOnDestination>false</IncludeSetAclProviderOnDestination>
  </PropertyGroup>    
</Project>
Then, the local publish is good to go. But, there is one thing left to do to make the TFS build to publish the output to your server, making a Web Deployment. In the the edit section of the build, go to the tab "Process" and the section "Advanced" and add following to the "MSBuild arguments": 

/p:DeployOnBuild=True
/p:DeployTarget=MsDeployPublish
/p:MSDeployPublishMethod=WMSVC
/p:AllowUntrustedCertificate=true
/p:CreatePackageOnPublish=True
/p:DeployIisAppPath="Your Website URL"  
/p:MsDeployServiceUrl=allium.arvixe.com
/p:username=youraccount_dploy
/p:password=MyPassword@1234

These sites help me find the correct arguments:

After this your good to go. Keep up the coding!

Inga kommentarer:

Skicka en kommentar