11
votes

I know I can do this to build and deploy:

msbuild mysln.sln /p:DeployOnBuild=true /p:PublishProfile=<profile-name>

But I want to build in one step, move those artifacts to another location, then deploy.

I could use msdeploy.exe to deploy, but I'd prefer to just do this with the msbuild command (which will locate and call msdepoy with the right args for me) the same way I do it now, but instead of DeployOnBuild I just want to Deploy.

Edit: just to add to this, its a pain to create an msdeploy package and msbuild is already doing all this for me which is why I would like to have it orchestrate this for me.

Edit: Is there a way I can see exactly what msbuild/msdeploy commands msbuild is running to create and deploy a package? I guess if I can record these exact commands I could do it manually and have msbuild just create the package and run the msdeploy command to deploy it. But I can't see what msbuild is actually doing.

1

1 Answers

0
votes

You can define a configuration at solution level that tells msbuild which project has to be built/published/both. Obviously, to enable the "Publish" option, you have to setup also a publish profile for the project you want to deploy. But you should be able to simply uncheck the "Build" ones.

Here are some informations about solution configuration and how you can reference these configurations from your msbuild command:

MSDN Solution Configuration

So, in your case, i would do a configuration to build and one to deploy.