Archive

Archive for December, 2010

Using TFS 2010 Team Build Web Deployment with IIS 6

December 13th, 2010 1 comment

We recently attempted to get a Visual Studio 2010 web project set up for automatic deployment using Team Foundation Server 2010. There are plenty of blog posts outlining the setup procedure when deploying to IIS 7 but there is minimal documentation on deploying to IIS 6.

After digging we ended up with the following MSBuild parameters which worked on our dev laptops using msbuild.exe but didn’t work on our Team Build server:

/p:DeployOnBuild=true
/p:DeployTarget=MSDeployPublish
/p:MSDeployPublishMethod=RemoteAgent
/p:DeployIisAppPath="Default Web Site/(directory>)"
/p:MsDeployServiceUrl="http://(webserver)/msdeployagentservice"
/p:username=****
/p:password=****

When running a Team Build, the build failed with the following error:

C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Web\
Microsoft.Web.Publishing.targets (1657): The "MapUriToIisWebServer" task failed unexpectedly. 
System.Runtime.InteropServices.COMException (0x80005000): Unknown error (0x80005000) 
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_IsContainer()
at System.DirectoryServices.DirectoryEntries.CheckIsContainer()
at System.DirectoryServices.DirectoryEntries.Find(String name, String schemaClassName)    
at Microsoft.Web.Publishing.Tasks.MapUriToIisWebServer.get_IisMajorVersion()
at Microsoft.Web.Publishing.Tasks.MapUriToIisWebServer.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, 
TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, 
TaskExecutionMode howToExecuteTask, Boolean& taskResult)

When we ran msbuild.exe on the project locally using the same parameters we noticed the following warning in the output (in bright yellow):

Validating Web Deploy package/publish related properties... 
C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3436,5): warning : Setting both property values of DeployAsIisApp and IncludeIisSettingsOnPublish to true is not recommended, as IncludeIisSettingsOnPublish is a superset of DeployAsIisApp [(projectfile).csproj]

Our solution for getting the deployment working with IIS 6 was simply to append the following additional MS Build parameter:

/p:IncludeIisSettingsOnPublish=false