Skip to content

Instantly share code, notes, and snippets.

@beccasaurus
Created March 21, 2011 22:17
Show Gist options
  • Save beccasaurus/880341 to your computer and use it in GitHub Desktop.
Save beccasaurus/880341 to your computer and use it in GitHub Desktop.
MSBuild equivalent of Visual Studio "Publish"

Publish via MSBuild

Note: the publish-via-msbuild.bat shown here simply builds the site and drops it into a directory, transforming the Web.configs

It does NOT sync the directory in any meaningful way.

To do that, I recommend using a tool like Rsync or MSDeploy

MSDeploy example:

msdeploy.exe -verb:sync -source:dirPath="C:\mysite" -dest:dirPath="C:\this\is\where\i\want\to\deploy"  -enableRule:DoNotDeleteRule

The DoNotDeleteRule says "hey, if this file exists in the destination but not in the source, leave it alone"

msbuild /t:Rebuild /p:Configuration=Release;OutDir=C:\mysite\bin\;WebProjectOutputDir=C:\mysite\;UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False src\MySite.csproj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment