How to create only one web deployment using TFS

I just need to create a Web Deployement package using the TFS assembly and don't want to deploy it automatically to IIS.

I added the following two parameters in the assembly definition -> MSBuild Arguments

/ p: CreatePackageOnPublish = true / p: DeployOnBuild = true

The problem is that I do not get the ZIP file at the delete location and I get the following error.

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

What could be the problem?


Now i get another error

Error: The web deployment task failed. (An object of type manifest and path e: \ TFS \ Dev \ ApplicationName \ Binaries \ Release_PublishedWebsites \ ApplicationName_Package \ ApplicationName.SourceManifest.xml cannot be created.)

error: An object of type manifest and the path e: \ TFS \ Dev \ ApplicationName \ Binaries \ Release_PublishedWebsites \ ApplicationName_Package \ ApplicationName.SourceManifest.xml could not be created.

Error: One or more entries in the sitemanifest manifest is invalid.

error: Application '/ ApplicationName' does not exist on the website 'Default website'.

+6
source share
3 answers

I believe you just need to add the package target to your build for the web project.

/t:Build;Package 

I use this target in my tfs assembly to create a _PublishedWebsite zip folder for a while with success.

EDIT: Explaining the purpose of the package If you look at your csproj file for your web application as an XML file, you will see that it includes the following

 <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /> 

This includes many web goals during the build process. Hack this file open, and at the bottom you will 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 will see that it declares a variable to designate the "target" to be called in Deploy as "package"

  <DeployDefaultTarget Condition="'$(DeployDefaultTarget)'==''">Package</DeployDefaultTarget> 

If you read this file later, it will give you an idea of ​​how packaging and deployment work under covers, and what set of properties and goals you can manipulate to customize your build.

In short, if you call

  msbuild yourwebapplication.csproj /t:Package /p:Configuration=Release 

It should create a web deployment package for you to configure the Release of your application.

+5
source

I had the same problem and the only thing that resolved this was the following:

  • Open the IIS Management Console
  • Go to the default website.
  • Add a new application named 'ApplicationName'
  • Run msbuild again. He will work.
0
source

Possible duplicate MSBuild DeployOnBuild = true not published

I had the same problem with Atlassian Bamboo and it fixed it for me: from the Visual Studio machine, copy the contents of "C: \ Program Files (x86) \ MSBuild \ Microsoft \ VisualStudio \ v10.0 \ Web" to the TFS build server .

0
source

Source: https://habr.com/ru/post/910239/


All Articles