MsBuild not finding publish profile
Asked Answered
D

4

17

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

Demodulation answered 24/7, 2013 at 16:42 Comment(4)
Shouldn't the Configuration parameter be something like Debug or Release rather than the value of the PublishProfile parameter?Scarecrow
It's the name of a valid build configurationDemodulation
Worth trying a publish profile name without spaces. Have been this kind of thing cause issues before.Tabber
In my case, I have to remove "." from publish profile name to make it work.Gibert
R
32

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!

Roti answered 28/1, 2014 at 4:32 Comment(4)
The /p:PublishProfileRootFolder fixed it for me, but without the quotes around the value.Detain
YEEES!! OH DEAR GOD YES!! ...two weeks... "installing the Azure SDK (1.8) on the build server (Otherwise the publish profiles were ignored)" I upgraded me build server to 2008 R2 with MSBuild 12 and this stopped working. Every other solution was "stop using publish profiles, use command line properties" but that's just awful, I wanted them under source control. Thank god for +MattWoodward ...Aerophone
Specifically I used this link: azure.microsoft.com/en-gb/downloads/archive-net-downloads We use VS 2012 and /p:VisualStudioVersion=11.0 so I downloaded the VS 2012 Link. I guess it fixed the v11 targets? Those links are WPI auto loaders that fire up WPI 5 and set it to install a specific set of files. Nice and automatic. To clarify, exact link/version was VS 2012 under the "2.6" heading, the latest version that included VS 2012 in it's list.Aerophone
+RoboJ1M really glad I could help you out mate, it's a nightmare territory to be in when you're sorting out your builds with TC and things start going wrong!Roti
I
3

Ran into a similar problem today. In my case it was a 'path too long' issue. When I shortened the name of the publish profile, the web deploy package was built without a problem.

Ivett answered 18/12, 2017 at 15:38 Comment(2)
Similiar, I had a . in the Publish Profile name and that made if fail until I removed the .Submerse
This worked. To rename, in the VS Publish tab, clicked on More Actions (next to new profile) -> RenameFarquhar
D
2

The answer supplied by Matt Woodward got me closer to the solution but one critical step was missing for me. Specifically, I needed to specify the publishProfileRootFolder property for the MSBuild task as follows:

<Target Name="Publish">
    <MSBuild Targets="Build" Projects="$(SolutionDir)\$(ProjectFile)"
    Properties="DeployOnBuild=true;publishProfile=UAT;publishProfileRootFolder=$(PublishProfileRootFolder);publishUrl=$(PublishUrl)" />
</Target>

I also chose to embed the value for $(PublishProfileRootFolder) in the MSBuild project file directly as opposed to passing it as a command line parameter:

<PropertyGroup>
    <PublishProfileRootFolder>$(MSBuildProjectDirectory)\MyProjectPath\Properties\PublishProfiles</PublishProfileRootFolder>
</PropertyGroup>
Diachronic answered 22/6, 2017 at 14:6 Comment(0)
H
0

I had this problem with an API web project. In my case the solution was to add the property: WebPublishProfileFile in the same way I used the property: PublishProfile. Then this error message disapeared.

"c:\Windows\Microsoft.Net\Framework64\v4.0.30319\MSBuild.exe" C:\Projects\WebApp\WebAPIProject.csproj /p:DeployOnBuild=true /p:PublishProfile="C:\Projects\Publishes\WebAppPublishProfile.pubxml "/p:WebPublishProfileFile=C:\Projects\Publishes\WebAppPublishProfile.pubxml
Hedrick answered 18/5, 2018 at 10:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.