I just need to create Web Deployement package using TFS build and don't want to deploy it automatically in IIS.
I have added the below two parameters in Build Definition - > MSBuild Arguments
/p:CreatePackageOnPublish=true /p:DeployOnBuild=true
The probelm is I am not getting the ZIP file in drop location and getting the below 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)
What could be the issue?
Now I am getting different error
error : Web deployment task failed.(Object of type 'manifest' and path 'e:\TFS\Dev\ApplicationName\Binaries\Release_PublishedWebsites\ApplicationName_Package\ApplicationName.SourceManifest.xml' cannot be created.)
error : Object of type 'manifest' and path 'e:\TFS\Dev\ApplicationName\Binaries\Release_PublishedWebsites\ApplicationName_Package\ApplicationName.SourceManifest.xml' cannot be created.
error : One or more entries in the manifest 'sitemanifest' are not valid.
error : Application '/ApplicationName' does not exist in site 'Default Web Site'.
I believe you just need to add the 'Package' target to your build for the web project.
/t:Build;Package
I've been using that target in my tfs build to generate the _PublishedWebsite folder with the package zip for a while now with success.
EDIT: Explanation of Package target If you look at your csproj file for your web application as an XML file, you'll see that it includes the following
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
This includes a bunch of web targets into your build process. Crack this file open and at the bottom you'll see that it in turn includes
<Import Project="..\Web\Microsoft.Web.Publishing.targets" Condition="Exists('..\Web\Microsoft.Web.Publishing.targets')" />
This file contains the definition of the Web Deployment process for MSBuild. You'll see that it declares a variable to denote the "target" to invoke on a Deploy as being "Package"
<DeployDefaultTarget Condition="'$(DeployDefaultTarget)'==''">Package</DeployDefaultTarget>
If you read through this file further it will give you an idea of how Packaging and Deployment work under the covers and what the set of properties and targets are you can manipulate to customize your build.
Long story short though, if you call
msbuild yourwebapplication.csproj /t:Package /p:Configuration=Release
It should build you the web deployment package for the Release configuration of your app.
I had the same issue and the only thing that resolved it was this:
Possible duplicate of MSBuild DeployOnBuild=true not publishing
I had the same problem with Atlassian Bamboo, and this fixed it for me: From a machine with Visual Studio copy the contents of "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web" to the TFS Build server.
User contributions licensed under CC BY-SA 3.0