Home > Uncategorized > Visual Studio 2010 Publish Command from msbuild Command line

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
  • Facebook
  • Twitter
  • Delicious
  • Reddit
  • StumbleUpon
  • Share/Save/Bookmark
Author: Christopher Patterson Categories: Uncategorized Tags:
  1. BadBadMan
    August 31st, 2010 at 13:15 | #1

    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!

  2. September 1st, 2010 at 20:11 | #2

    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?

  3. September 6th, 2010 at 01:18 | #3

    Works great for a solution with only one web application. My solution has ~6 class libraries and two WAPs. Any suggestions?

  4. September 24th, 2010 at 15:55 | #4

    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.

  5. Frank – the beginner
    January 13th, 2011 at 17:32 | #5

    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

  6. January 14th, 2011 at 10:36 | #6

    Yes. That should work. Give it a try.

  7. Frank – the beginner
    February 23rd, 2011 at 14:53 | #7

    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

  8. Frank – the beginner
    March 1st, 2011 at 15:32 | #8

    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

  9. March 8th, 2011 at 12:28 | #9

    No. I do not believe so. However, you can use msbuild 4 to target other versions of the .net framework.

  10. Alexey
    March 28th, 2011 at 11:06 | #10

    If you need to “Publish” specific project from solution use this:

    The key is to specify Targets here.

    @Dave

  11. Luis Delgado
    September 5th, 2012 at 13:41 | #11

    Great!!! it is working like a charm… I spent some hours trying to find so nice and simple solution.

  12. Nick
    October 10th, 2012 at 11:53 | #12

    @Alexey
    This post seems to be missing what we are supposed to use…where exactly do we specify the targets?

  13. Cleiviane
    October 22nd, 2012 at 15:11 | #13

    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

  14. James
    December 21st, 2012 at 18:05 | #14

    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.

  15. Wes Huebert
    January 19th, 2014 at 23:57 | #15

    Thank you!

  1. No trackbacks yet.