Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MsBuild not finding publish profile

I have a VS 2012 solution that contains two projects (WCF C# Service App and a VB Web UI) that I'm trying to deploy via TeamCity/MsBuild command line. Each project contains a publish profile - let's call it "Test Profile" - that works fine when executed from withing the IDE.

However, when executed as two consecutive build steps, the C# project deploys fine, but the VB project fails with the following error:

[09:27:05][ValidatePublishProfileSettings] GetPublishingLocalizedString [09:27:05][GetPublishingLocalizedString] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(4435, 5): The value for PublishProfile is set to 'Test Profile', expected to find the file at 'C:\BuildAgent\work\61493e349d61af8c\Yms.Web.Ui__profiles\Test Profile.pubxml' but it could not be found.

Each build step is setup to use MsBuild v4.0, Run Platform x64, ToolsVersion 4.0. The command line parameters are:

/P:Configuration="Test Profile"
/p:DeployOnBuild=true /p:PublishProfile="Test Profile"
/p:VisualStudioVersion=11.0 /p:Password=james2

When run as a single build step against the solution rather than projects, I get the same error, except "Ui_profiles" in the error message is replaced with "PublishProfiles".

Any help at all is much appreciated, this is driving me batty

like image 867
ssis_ssiSucks Avatar asked Jul 24 '13 16:07

ssis_ssiSucks


People also ask

How do I publish with MSBuild?

You can pass /p:PublishUrl="newpath" to the msbuild command. You would also see this set in the csproj file which you can change.

How do I import a publishing profile into Visual Studio code?

Import the publish settings in Visual Studio and deployClick New or Create new profile. Select the option to import a profile. In the Publish dialog box, click Import Profile. Navigate to the location of the publish settings file that you created in the previous section.

How do I enable MSBuild?

Use MSBuild at a 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.


1 Answers

I had exactly the same issue but for a VS2010 Web Application project (with the Azure SDK 1.8 update to update the publishing options). It seemed as if the Web Publishing Targets provided by MS wouldnt evaluate the path for the Publish Profiles correctly.

I ended up doing two key things:

  • installing the Azure SDK (1.8) on the build server (Otherwise the publish profiles were ignored)
  • forcing the "PublishProfileRootFolder" parameter in the Teamcity build configuration (Otherwise this uses the incorrect path provided by the MS Web Publishing Targets)

My MSBuild command parameters looked as follows:

/P:DeployOnBuild=true
/P:PublishProfile=[Name of My Profile (without a file extension)]
/P:PublishProfileRootFolder="%teamcity.build.checkoutDir%\Source\Web Application\My Project\PublishProfiles" (where your publish profiles are stored)
/P:AllowUntrustedCertificate=true
/P:Password=%env.DomainPassword%

Hope this helps somebody in the same boat!

like image 191
Matt Woodward Avatar answered Sep 24 '22 07:09

Matt Woodward