Saturday, 17 August 2013

VS2012 MSBuild: Publish a Web Application Project with Existing Publish Profile

VS2012 MSBuild: Publish a Web Application Project with Existing Publish
Profile

In the Visual Studio 2012 Build menu, there's a Publish command. In this
you can establish profiles which are saved as .pubxml files in the
Properties folder of the Project. I have one such profile that's a simple
file copy operation - it just compiles the site and dumps it to a folder.
How can I use msbuild at the command line to publish a compiled web
application to a folder?



What I've tried
I've tried the example from this question:
After Publish event in Visual Studio
And the changes and examples given here:
http://www.digitallycreated.net/Blog/59/locally-publishing-a-vs2010-asp.net-web-application-using-msbuild
The latter seems to get closest, but it causes every library Project the
.csproj I'm attempting to publish from to throw an error:
Project "MainProj.csproj" (1) is building "ReferencedProj.csproj" (2) on
node 1 (default targets).
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(609,5):
error : The OutputPath property is not set for project
'ReferencedProj.csproj'. Please check to make sure that you have specified
a valid combination of Configuration and Platform for this project.
Configuration='Staging' Platform='AnyCPU'. 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. [ReferencedProj.csproj]
Done Building Project "ReferencedProj.csproj" (default targets) -- FAILED.
This approach is very similar to what's suggested in this answer:
http://stackoverflow.com/a/7077178/176877
The crucial difference may be that I'm in Visual Studio 2012, rather than
VS2008 or 2010.

No comments:

Post a Comment