lunes, 16 de marzo de 2015

Publish Visual Studio proyect from command line

Maybe, you need to set up an automatic build-publish-deploy proccess therefore publishing a visual studio proyect from command line is a must. It can be done very easiley with the following command:


[path to msbuild] "[path  to .csproj file]" /p:Configuration=[Debug|Release|Other you created]  /p:DeployOnBuild=true /p:PublishProfile=[project publish profile name]

e.g.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild "%~dp0AppFolder/MyProject.csproj" /p:Configuration=Production /p:DeployOnBuild=true /p:PublishProfile=Production_Profile 


NOTE: Due i am using a .bat file to executie my command, i use the %~dp0 "trick" that is replaced with the current path of the .bat file achieving a portable "deployer" script

The trick.bat has the following code:

echo %~dp0 pause

The output wil be




Now, if you execute the .bat you will get something like this

No hay comentarios:

Publicar un comentario