Visual Studio 2010 Publish Command from msbuild Command line

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

23 thoughts on “Visual Studio 2010 Publish Command from msbuild Command line

  1. BadBadMan

    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. Christopher Patterson Post author

    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. Matthew

    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.

  4. Frank - the beginner

    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

  5. Frank - the beginner

    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

  6. Frank - the beginner

    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

  7. Luis Delgado

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

  8. Cleiviane

    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

  9. James

    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.

  10. Bessie

    If you are going for most excellent contents like myself, only visit this site every day for
    the reason that it gives feature contents, thanks

  11. Pingback: girl chat

  12. ratemyarea.Com

    Representing that repair work services will be completed by a particular day in orrder tto induce the sale, then failing to have
    the repair service solutions finished byy that day.

  13. Pingback: Chiropractors In Santa Monica

  14. Pingback: MSBuild脚本和VS2010发布应用Web.config变换 – CodingBlog

  15. Chad

    I do not know if it’s just me or if perhaps everyone else encountering issues with your site.

    It seems like some of the text on your posts are running off the screen. Can someone
    else please comment and let me know if this is happening to them as well?
    This might be a issue with my internet browser because I’ve had this happen before.
    Kudos

Leave a Reply

Your email address will not be published. Required fields are marked *