Sunday, 28 April 2013

How to run Visual Studio's Publish equivalent in command prompt using MsBuild

I struggled to get MSBuild to do exactly the same thing that right clicking solution and selecting "Publish" does.

I have finally found it!


%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
     HostingSample\HostingSample.csproj /
     t:ResolveReferences;_CopyWebApplication /
     p:WebProjectOutputDir=C:\HostingSample /p:OutDir=C:\HostingSample