MSBuild 2010 - 如何将 Web 应用程序发布到特定位置 (nant)?
我正在尝试让 MSBuild 2010 将 Web 应用程序发布到特定位置。 我可以让它将部署包发布到特定路径,但部署包随后会添加自己的更改路径。
例如:如果我告诉它发布到 C:\dev\build\Output\Debug
那么实际的 Web 文件最终会在 C:\dev\build\Output\Debug\Archive \Content\C_C\code\app\Source\ControllersViews\obj\Debug\Package\PackageTmp
并且路径的 C_C
部分发生了变化(不确定它如何选择路径的这部分)。
这意味着我不能只从发布位置编写副本脚本。
我现在正在使用这个 nant/msbuild 命令:
<target name="compile" description="Compiles">
<msbuild project="${name}.sln">
<property name="Platform" value="Any CPU"/>
<property name="Configuration" value="Debug"/>
<property name="DeployOnBuild" value="true"/>
<property name="DeployTarget" value="Package"/>
<property name="PackageLocation" value="C:\dev\build\Output\Debug\"/>
<property name="AutoParameterizationWebConfigConnectionStrings" value="false"/>
<property name="PackageAsSingleFile" value="false"/>
</msbuild>
关于如何让它将网络文件直接发送到特定位置有什么想法吗?
I'm trying to get MSBuild 2010 to publish a web app to a specific location.
I can get it to publish the deployment package to a particular path, but the deployment package then adds its own path that changes.
For example: if I tell it to publish to C:\dev\build\Output\Debug
then the actual web files end up at C:\dev\build\Output\Debug\Archive\Content\C_C\code\app\Source\ControllersViews\obj\Debug\Package\PackageTmp
And the C_C
part of the path changes (not sure how it chooses this part of the path).
This means I can't just script a copy from the publish location.
I'm using this nant/msbuild command at the moment:
<target name="compile" description="Compiles">
<msbuild project="${name}.sln">
<property name="Platform" value="Any CPU"/>
<property name="Configuration" value="Debug"/>
<property name="DeployOnBuild" value="true"/>
<property name="DeployTarget" value="Package"/>
<property name="PackageLocation" value="C:\dev\build\Output\Debug\"/>
<property name="AutoParameterizationWebConfigConnectionStrings" value="false"/>
<property name="PackageAsSingleFile" value="false"/>
</msbuild>
Any ideas on how to get it to send the web files directly to a specific location?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对应的 NAnt 脚本:
参考文献
另请参阅团队构建:使用 MSDeploy 本地发布
Corresponding NAnt script:
References
See also Team Build: Publish locally using MSDeploy
如果您使用的是 VS2010 Web 应用程序(而不是网站项目),请考虑在项目中设置打包/发布 Web 设置,并在 nant 脚本中构建“项目”目标。
这里有很多有趣的 msdeploy 优点和背景: http://www.hanselman.com/blog/WebDeploymentMadeAwesomeIfYoureUsingXCopyYoureDoingItWrong .aspx
在我的 nant 脚本中,我运行以下 msbuild 命令:
我的 basename nant 变量给出 VS 解决方案文件 (.sln) 和项目文件 (.csproj) 的名称对于网络应用程序。我碰巧更喜欢项目设置中所示的 zip 文件部署:
有还有一个怪癖。如果在目标计算机上安装 MSDeploy 版本 2.0,则必须编辑 .deploy.cmd 文件以更改 MSDeploy 版本号,如下所示:
更改
为
If you are using a VS2010 web application (as opposed to a web site project), consider setting up the Package/Publish Web settings in your project and building the 'Project' target in your nant script.
Lots of juicy msdeploy goodness and background here: http://www.hanselman.com/blog/WebDeploymentMadeAwesomeIfYoureUsingXCopyYoureDoingItWrong.aspx
In my nant scripts, I run the following msbuild commands:
My basename nant variable gives the name of both the VS solution file (.sln) and the project file (.csproj) for the web application. I happen to prefer the zip-file deployment as shown in my project settings:
There is one additional quirk. If you install MSDeploy version 2.0 on the target machine, the .deploy.cmd file must be edited to change the MSDeploy version number as follows:
Change
To
我认为您使用了错误的属性。请尝试使用 OutDir 属性。
就个人而言,我直接调用 MsBuild.exe,而不是使用 msbuild 标记:
MSBuildPath - MsBuild.exe 的路径(允许您定位所需的任何框架版本)
ProjectFile -项目文件的相对路径
LocalDeployPath - 将输出所有内容的本地文件夹。您的复制脚本也将使用它作为源目录。
解决方案配置 - 发布、调试
I think you're using the wrong property. Try the OutDir property instead.
Personally, I call MsBuild.exe directly instead of using the msbuild tag:
MSBuildPath - The path to MsBuild.exe (allows you to target any framework version you want)
ProjectFile - The relative path to your project file
LocalDeployPath - The local folder where everthing will be outputed. Your copy script will use also use this as the source directory.
SolutionConfiguration - Release, Debug