Reputation: 67
I have a Visual Studio 2013 project. I need to deploy it to remote Windows Server via command line, is this possible?
I tried the following command:
MSBuild.exe C:\BuildAgent\work\e1434fd989e26b76\WebService.csproj /T:Package /P:Configuration=Release
This packages the project for me. Now what should I do to deploy it to the server via command line?
Upvotes: 2
Views: 2060
Reputation: 2984
Create a new custom publish profile from visual studio. After creating it validate the connection from visual studio.Save this profile.Now in Properties/PublishProfiles
there will be the new publish profile.pubxml
.
After that try this.
msbuild "PATH_TO_SOLUTION_FILE" /p:DeployOnBuild=true /p:PublishProfile="PATH_TO_PUBLISH_PROFILE" /p:AllowUntrustedCertificate=true /p:UserName=USER_NAME /p:Password=PASSWORD
If you are executing the above from solution file path then just mention the solution name and publishing profile name. There is no need to give the entire path.
Upvotes: 1
Reputation: 21488
You can define a publishing profile and deploy by calling an msbuild.exe with:
/p:DeployOnBuild=true /p:PublishProfile=Foo
This is described here:
http://www.asp.net/mvc/overview/deployment/visual-studio-web-deployment/command-line-deployment
Upvotes: 0