VS2010 Web Publish command line version of File System deploy

CubanX picture CubanX · Oct 27, 2010 · Viewed 16.6k times · Source

Folks,

In a nutshell, I want to replicate this dialog: alt text

It's a Visual Studio 2010 ASP.Net MVC project. If I execute this command, I get all the files I want, including the transformed web.configs in the "C:\ToDeploy" directory.

I want to replicate this on the command line so I can use it for a QA environment build.

I've seen various articles on how to do this on the command line for Remote Deploys, but I just want to do it for File System deploys.

I know I could replicate this functionality using nAnt tasks or rake scripts, but I want to do it using this mechanism so I'm not repeating myself.

I've investigated this some more, and I've found these links, but none of them solve it cleanly:

Thanks in advance!

Answer

CubanX picture CubanX · Oct 28, 2010

Ok, finally figured this out.

The command line you need is:

msbuild path/to/your/webdirectory/YourWeb.csproj /p:Configuration=Debug;DeployOnBuild=True;PackageAsSingleFile=False

You can change where the project outputs to by adding a property of outdir=c:\wherever\ in the /p: section.

This will create the output at:

path/to/your/webdirectory/obj/Debug/Package/PackageTmp/

You can then copy those files from the above directory using whatever method you'd like.

I've got this all working as a ruby rake task using Albacore. I am trying to get it all done so I can actually put it as a contribution to the project. But if anyone wants the code before that, let me know.

Another wrinkle I found was that it was putting in Tokenized Parameters into the Web.config. If you don't need that feature, make sure you add:

/p:AutoParameterizationWebConfigConnectionStrings=false