Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Full list of /P MSDeploy arguments for MSBuild from TeamCity

I currently use the MSBuild runner in TeamCity for continuous integration on my local server and this works very well. However, I'm having trouble finding a full list of supported command line switches for MSDeploy in the format that TeamCity expects them.

In my 'Parameters' section at the moment I using the following switches:

  /P:Configuration=OnCommit
  /P:DeployOnBuild=True
  /P:DeployTarget=MSDeployPublish
  /P:MsDeployServiceUrl=https://CIServer:8172/MsDeploy.axd
  /P:AllowUntrustedCertificate=True
  /P:MSDeployPublishMethod=WMSvc
  /P:CreatePackageOnPublish=True
  /P:UserName=Kaine
  /P:Password=**********
  /P:DeployIISAppPath="OnCommit/MySite"
  /P:SkipExtraFilesOnServer=True
  /P:DeployAsIisApp=True

All of these seem to work fine and the MSDeploy works as expected.

The trouble comes when I want to add additional parameters.

I've looked up MSBuild parameters and the MSDeploy documentation and I only seem to find command line parameters like these:

msbuild SlnFolders.sln /t:NotInSolutionfolder:Rebuild;NewFolder\InSolutionFolder:Clean

http://msdn.microsoft.com/en-us/library/ms164311.aspx

It seems that these references for command line arguments don't correspond with the /P: format - for example CreatePackageOnPublish and DeployIISAppPath aren't recognised command line parameters, but they work fine in the TeamCity build process.

Where can I find a full documented list of MSDeploy arguments in the format

/P:Param=Value

Additional info:

There's a list of parameters here:

http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build.workflow.activities.msbuild_properties.aspx

However this is not a complete list - for example, this list doesn't include DeployAsIisApp or SkipExtraFilesOnServer, which are both parameters that work from the Team City Build.

Also this related question (possibly duplicate): Valid Parameters for MSDeploy via MSBuild which contains some arguments - but still not a definitive list.

like image 252
Kaine Avatar asked Apr 16 '14 14:04

Kaine


People also ask

How do you clean MSBuild solution?

Cleaning up specific projects: msbuild MyProjectFile1 /t:Clean msbuild MyProjectFile2 /t:Clean ... This has to be repeated for all projects you need to clean, because MSBuild only accepts single project on command line.

How do I find MSBuild path?

For example, the path to MSBuild.exe installed with Visual Studio 2019 Community is C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe You can also use the following PowerShell module to locate MSBuild: vssetup. powershell.

How do I run MSBuild from command prompt?

To run MSBuild at a command prompt, pass a project file to MSBuild.exe, together with the appropriate command-line options. Command-line options let you set properties, execute specific targets, and set other options that control the build process.


2 Answers

Firstly, the short answer is you can't find the complete list. MSBuild does not have a complete list of parameters you can chose from since you can send any parameter you like. It is a means of communication between the caller of MSBuild and the author of the MSBuild build script (a vs sln or csproj file for instance).

If the build script use the parameter it is used otherwise it is ignored.

So this is a valid call to msbuild:

msbuild /p:<anything>=<anything>

Secondly, you shouldn't send parameters to msbuild from teamcity using the /p: command options. Instead, set configuration or system properties in your teamcity build configuration. They will be passed to msbuild automatically as parameters.

like image 200
8DH Avatar answered Oct 25 '22 12:10

8DH


Here are the parameters used by Visual Studio Team Services when creating an ASP.NET (Preview) build definition:

/p:DeployOnBuild=true 
/p:WebPublishMethod=Package 
/p:PackageAsSingleFile=true 
/p:SkipInvalidConfigurations=true 
/p:PackageLocation="$(build.artifactstagingdirectory)\\"

One may also extrapolate from the <PropertyGroup /> blocks defined in these examples:

https://msdn.microsoft.com/en-us/library/ff398069(v=vs.110).aspx

From this example:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>Package</WebPublishMethod>
    <LaunchASiteUrlAfterPublish>False</LaunchASiteUrlAfterPublish>
    <SiteUrlToLaunchAfterPublish />
    <MSDeployServiceURL />
    <DeployIisAppPath />
    <RemoteSitePhysicalPath />
    <AllowUntrustedCertificate>False</AllowUntrustedCertificate>
    <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
    <DeployAsIisApp>True</DeployAsIisApp>
    <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
    <UserName />
    <SavePWD>True</SavePWD>
    <PublishDatabaseSettings>
      <!— this section omitted to keep the example short -->
    </PublishDatabaseSettings>
  </PropertyGroup>
</Project>

You could derive the following list:

  • WebPublishMethod
  • LaunchASiteUrlAfterPublish
  • SiteUrlToLaunchAfterPublish
  • MSDeployServiceURL
  • DeployIisAppPath
  • RemoteSitePhysicalPath
  • AllowUntrustedCertificate
  • SkipExtraFilesOnServer
  • DeployAsIisApp
  • MSDeployPublishMethod
  • UserName
  • SavePWD
  • PublishDatabaseSettings
like image 43
Matt Borja Avatar answered Oct 25 '22 12:10

Matt Borja