Visual Studio 2010 Publish Command from msbuild Command line
July 15th, 2010
Seems like there a bunch of confusion about how to produce the “Publish” behavior provided by Visual Studio 2010 from msbuild 4 command line. The question I keep seeing over and over again is: How do I publsih the output of a web application with web.config tranformations included. This should get the job done:
msbuild solution.sln
/p:Configuration=Release;DeployOnBuild=true;
DeployTarget=Package;_PackageTempDir=..\publish
How did you find the documentation on this topic? I’m looking for all the different possible values for /p:DeployTarget, /p:MsDeployPublishMethod, etc. and can’t find it andywhere. Where did you find the documentation to know that ‘Package’ was an option for /p:DeployTarget?
Thanks!
I was not able to find any official documentation on those arguments. Basically, I was able to put it together based on examples on stackoverflow and various blog posts. What are you trying to accomplish?
Works great for a solution with only one web application. My solution has ~6 class libraries and two WAPs. Any suggestions?
For the love of god thank you. This was the most annoying 12 hours getting ccnet configured in my life. This was my last problem. I will now go dance on top of my office building.
ok so I just want to build my .sln the publish it to a d:\temp_stage directory so I can look at it before I send it to QA.
do I set PackageTempDir=d:\temp_stage ? or must that be predefined
Yes. That should work. Give it a try.
Hmm sry its been a while getting an error–> MSB4057:The target “PackageTempDir=temp_stage” does not exist in the project..
But then it gives me the location of the file it is looking at my .csproj file. Your thoughts…. cmd below
d:\Program Files\Microsoft Visual Studio 10.0\VC>msbuild “D:\StarTeam\Falcon Dia
lysis\WebSites2010\Davita.FalconDialysis.sln” /p:Configuration=release;DeployOnB
uild=true;DeployTarget=PackageTempDir=D:\temp_stage
I got it working however, I have an easier question: Can use msbuild 3.5 to compile a dotnet 4.0 project? Thanks for all your help
No. I do not believe so. However, you can use msbuild 4 to target other versions of the .net framework.
If you need to “Publish” specific project from solution use this:
The key is to specify Targets here.
@Dave
Great!!! it is working like a charm… I spent some hours trying to find so nice and simple solution.
@Alexey
This post seems to be missing what we are supposed to use…where exactly do we specify the targets?
Hi. I try to do this, but I have several projects on my solution and that deploy just the last one. How can I specific that is to deploy all projects on my solution? Thanks for help
I suspect this would work great if I had a target in my project that fits with the ‘DeployTarget=Package’specified in the command line.
Could you please explain what the target does or give us a link to some documentation.