从 msbuild 为 Visual Studio 2012 调用发布 [英] Invoke a publish from msbuild for visual studio 2012

查看:25
本文介绍了从 msbuild 为 Visual Studio 2012 调用发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于 VS2010,在我使用 Web 部署项目 (WDP) 帮助打包我的网站以进行生产部署之前.我有一个在发布模式下编译解决方案的 MSBuild 脚本.其输出是由 WDP 编译和清理的生产就绪网站文件.

For VS2010 and before I was utilizing Web Deployment Projects (WDP) to help package my website for production deployment. I had a MSBuild script that compiled the solution in release mode. An output of that was production ready website files compiled and cleaned by the WDP.

我看到 2012 年的 WDP 已被删除,并在 Web 应用程序的属性中创建了一个新选项卡.选项是相同的,但现在调用是通过 Publish 选项完成的(在您刚刚在发布模式下编译之前).

I see for 2012 WDP have been removed, and a new tab has been created in the properties for the web application. The options are the same, but now the invocation of this is done via the Publish option (before you just compiled in release mode).

所以问题是这个.如何从 MSBuild 脚本调用发布操作?我发现了一些旧帖子...

So the question is this. From an MSBuild script, how do I invoke a Publish operation? I found some old posts that...

msbuild /target:publish

会成功.但这在 2012 年似乎行不通.

would do the trick. But that doesn't seem to work in 2012.

另外,我在我的 msbuild 任务中尝试过...

Also, I tried in my msbuild task...

<MSBuild Properties="Configuration=Publish;" 
         StopOnFirstFailure="true" 
         Projects="$(BuildDirectory)\MySolution.sln"></MSBuild>

...但是 msbuild 只是报告了未知配置".

...but msbuild just reported "unknown configuration".

如何让 msbuild 从命令行运行发布选项?

How can I have msbuild run the publish option from the command line?

推荐答案

我无法运行发布,但查看 Visual Studio 的输出,我想我找到了替代解决方案.结果是 obj\Release\AspnetCompileMerge 文件夹有一个可部署的干净版本的项目.它包含与最终输出文件夹相同的字节文件.

I wasn't able to get the publish to run, but looking at the output from Visual Studio I think I have found an alternate solution. Turns out the obj\Release\AspnetCompileMerge folder has a deployable and clean version of the project. It contains byte identical files to the final output folder.

我确实必须更改我的 msbuild 脚本以包含 DeployOnBuild 选项...

I did have to change my msbuild script to include the DeployOnBuild option...

<MSBuild Properties="Configuration=Release;DeployOnBuild=True;" 
         StopOnFirstFailure="true" 
         Projects="$(BuildDirectory)\BigWave.ALL.sln"></MSBuild>

这篇关于从 msbuild 为 Visual Studio 2012 调用发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆