Web Deploy to Server with MSBuild
I have a publish profile set up in a VS 2012 project. When I right click on the project in VS, select Publish and click on the [Publish] button, it publishes the project to the server using the settings provided in the Publish Profile.
When I use msbuild and the command line, with the following syntax:
msbuild.exe .mvc.csproj /p:PublishProfile=DevServer
/p:DeployOnBuild=True /p:Password=MyPassword /p:AllowUntrustedCertificate=true
Then it builds the project, and gives me a message:
Package "mvc.zip" is successfully created as a single file at the following location: file:///c:/code/mvcsite/obj/Debug/Package
And then provides info on how to deploy the package.
How can I deploy from the command line? My ultimate goal is to run the deployment through TeamCity, and am right now trying to get my command line properties correct. However, the most that I can do from the command line right now is to create the deployment package, but not to run the actual deployment. How can I do both (preferably with one statement, to duplicate what happens in VS2012 when I deploy from there)?
Since you are building the .csproj you missed one important property
/p:VisualStudioVersion=11.0
This property was introduced in MSBuild 4.5 to facilitate project sharing between VS 2010 and VS 2012. A drawback; when building the .csproj you need to specify the value for this property. When building the solution file the value can be derived from the solution file version. Read more at my blog http://sedodream.com/2013/01/06/CommandLineWebProjectPublishing.aspx.
链接地址: http://www.djcxy.com/p/81638.html上一篇: 如何使用MSBuild脚本自动化Web部署特定的发布配置文件?
下一篇: 使用MSBuild将Web部署到服务器