使用MsBuild.exe和VS2010命令行进行Web部署/发布网站项目

时间:2014-04-16 08:19:55

标签: visual-studio-2010 command-line msbuild webdeploy web-deployment-project

我正在尝试使用MSBuild发布我的项目。我一直在网上搜索,但在这个阶段无法前进。我使用下面的代码

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" "C:\Projects\Employee\Employee.csproj"  /p:Configuration=Release /t:rebuild

此行成功编译和部署项目。但我的web.config文件位于

obj\Release\TransformWebConfig\original

我的dll位于

之下
obj\Release\Package\PackageTmp

我的问题是如何将其部署到特定文件夹。此外,我无法在互联网上找到所有参数和教程的有组织信息。你知道我在哪里可以找到吗?

我也是MsBuild和Web部署的新手。与我的问题相关的其他stackoverflow答案是更高级别。你能更清楚地解释一下吗?

1 个答案:

答案 0 :(得分:1)

如果您以下列方式致电MS build:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe TestApp.csproj /p:Configuration=Release /t:Package

通过指定目标"包"你命令MS打包网站。

它将继续构建和打包您的网站到MSDEPLOY包(特定的zip文件布局)。

示例构建的输出实际上非常有用,并为您提供下一步的线索,例如它告诉我们创建文件的位置:

 Package "TestApp.zip" is successfully created as single file at the following location:
 file:///C:/TestApp/obj/Release/Package

它还为我们提供了一个了解更多内容的链接:

To get the instructions on how to deploy the web package please visit the following link:
     http://go.microsoft.com/fwlink/?LinkId=124618

然后它会显示它在哪里创建了用于部署包的样本.cmd文件

Sample script for deploying this package is generated at the following location:
 C:\TestApp\obj\Release\Package\TestApp.deploy.cmd
 For this sample script, you can change the deploy parameters by changing the following file:
 C:\TestApp\obj\Release\Package\TestApp.SetParameters.xml
Done Building Project "C:\TestApp\TestApp.csproj" (Package target(s)).

这应该让您开始创建和执行快乐部署。

相关问题