Publish Profile not working when building website project
Asked Answered
E

2

11

I recognized that Web Deployment Projects are not supported in Visual Studio 2012. After reading this article, I tried to get Publish Profiles to work.

After installing Visual Studio Web Publish Update I was able to publish web site projects and web application projects with the new publish dialog in Visual Studio 2012.

Because we are using TFS 2010 Team Build I tried to use publish profile via MSBuild parameters. But the following statement only works to publish web application projects.

MSBuild.exe MyWebs.sln /p:Configuration=Release /p:DeployOnBuild=true;PublishProfile=DeployToDirectory.pubxml

If I try to publish website projects nothing happens. The publish profile of my website projects only works with the new publish dialog in Visual Studio 2012 but not when calling MSBuild.

Any idea?

Ezara answered 18/1, 2013 at 9:4 Comment(7)
Can you try adding VisualStudioVersion=11.0 to the properties list? If that doesn't work, if you could email me a detailed log I can help you. My email is sayedha [at] {MicrosoftDOTcom}. More info on VisualStudioVersion at sedodream.com/2012/08/19/….Unborn
Okay now I am having the same problem except that I notice that the build summary says that it can not find the publish profile xml where it expects it on the build server. When I go to this location, I find the OLD VERSION (different name) but not the new publish profile. Any clue why the old one keeps showing up? I have deleted it from the solution and the file system.Effusion
@Effusion - not sure if this helps, but I found a bug (i think) where msbuild will look in the wrong place for your publish profile. Try removing the ".pubxml" from the PublishProfile argument. Please see here for more info: discens.blogspot.co.uk/2013/02/…Facelift
@Dicens - Thanks, no dice though. I hadn't specified it. What I did do is add the new publish profile to the solution, check that in separate file, build, deleted the entire product directory of the build, and then checked the rest of my stuff in. The code still isn't published and fails silently, but at least the solution isn't breaking on build.Effusion
Just realized that this is for "Web Site Project". In that case you should: build .sln file and then build the website.publishproj and pass the parameters to the build when invoking website.publishproj.Unborn
I have this exact same issue. I'm maintaining a large project in one .sln with many legacy "Web Site Projects". I would love to use publish profiles for these but they just seem to not work. @SayedIbrahimHashimi , is the only why to make this work to build each website.publishproj independently as you suggest?Drisko
For Web site project yesUnborn
F
6

I have spent about 3 weeks wrestling with this in my own environment and think I have a solution.

I think the issue is that the website.publishproj file is never actually built when you pass in the solution. I managed to resolve this by doing the following:

  1. Please make sure you are using the new ASP.Net and Tools 2012.2 update. Download Here.
  2. Create a file next to the solution file called after.MyWebs.sln.targets. This file should look as follows:

    <!--?xml version="1.0" encoding="utf-8"?-->
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <Target Name="Deploy Website" AfterTargets="Build">
            <Message Text="Starting Website deployment" Importance="high">
            </Message>
            <MSBuild Projects="$(MSBuildProjectDirectory)\MyWebs\website.publishproj" 
            BuildInParallel="true" /> 
        </Target>
    </Project>
    

What this does is that when MSBuild starts building the solution file, it actually creates an MSBuild file in memory with the extension metaproj. There are ways to get MSBuild to save this file to disk so that you can inspect it but that is easily found on google. The file created in step one is injected into the metaproj file and is run after the build.

This was the only way I could get the new Publish Profiles to give me the output that I used to get with the old Web Deployment Propjects.

Word of warning: If you want to use this in a TFS build, then in this scenario, you will get a _PublishedWebsites folder in the drop location independent of the PublishUrl you specify in the pubxml file. This is something I am trying to resolve but so far, not having much joy.

Facelift answered 28/2, 2013 at 14:45 Comment(1)
When I am using the above logic for tfs. Getting Error like ##[error]\Microsoft.Common.CurrentVersion.targets(724,5): Error : The OutputPath property is not set for project 'BO.AnalytixCase.vbproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='any cpu'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. is there any solution ?Bobsleigh
A
1

I had the exact same problem as above. I deleted following key and Automated build started working fine.

**<Content Include="website.publishproj" />**
Agree answered 24/6, 2016 at 19:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.