如何配置MSBuild以将保存的publishProfile用于WebDeploy? [英] How do I configure MSBuild to use a saved publishProfile for WebDeploy?

查看:164
本文介绍了如何配置MSBuild以将保存的publishProfile用于WebDeploy?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已使用Visual Studio创建发布配置文件.它将该信息保存到位于我的项目目录根目录中的MyProject.Publish.xml中.

I have used Visual Studio to create a publish profile. It saved that information to MyProject.Publish.xml, located in the root of my project directory.

我希望在CI服务器上执行的MSBuild任务使用该文件作为其基本设置.理想情况下,如果我可以通过命令行参数覆盖属性,那将会很麻烦.

I would like the MSBuild task that gets executed on my CI server to use that file as its base settings. Ideally, if I could override properties via command line parameters, that would rock.

这可能吗?如果是这样,语法是什么?

Is this possible? If so, what is the syntax?

例如,我正在寻找类似的东西:

For example, I'm looking for something like:

MSBuild MyProject.csproj /P:UsePublishProfile=True /P:UserName=deployUser /P:Password=MyPassword

推荐答案

很遗憾地告诉您,VS2010使用的publish.xml文件并非旨在以这种方式使用.实际上,它甚至还没有设计成可与其他人签入/共享.

I'm sorry to tell you that the publish.xml file which VS2010 uses was not designed to be used in this way. In fact it was not even designed to be checked-in/shared with others.

用于读取/写入这些文件的逻辑严格包含在Visual Studio中,并且不能通过MSBuild获得. 因此,今天没有做到这一点的直接方法.调用msbuild.exe时,您必须传递各个属性的名称/值.您可以在团队构建:使用MSDeploy在本地发布了解更多信息.

The logic for reading/writing those files are strictly contained inside Visual Studio and not available through MSBuild. So there is no straight forward way of doing this today. You have to pass in the individual property names/values when you call msbuild.exe. You can see a similar question that I answered at Team Build: Publish locally using MSDeploy for more info.

请注意,我们已经在即将发布的Visual Studio版本中解决了此问题.您可以通过下载VS 11开发人员预览来查看是否.现在,所有配置文件都保存到它们自己的文件中(在解决方案资源管理器"中属性"节点的PublishProfiles下).现在,他们可以签入并与团队成员共享.这些文件现在是MSBuild文件,您可以根据需要自定义它们.为了从命令行发布,只需传递DeployOnBuild = true并将PublishProfile设置为配置文件的名称.例如:

Just so you know we have addressed this in the up coming version of Visual Studio. You can see if by downloading the VS 11 developer preview. Now all the profiles are saved into their own files (under the PublishProfiles in the Properties node in Solution Explorer). They are now designed to be checked in and shared with team members. These files are now MSBuild files and you can customize them if you wish. In order to publish from the command line just pass DeployOnBuild=true and set PublishProfile to the name of the profile. For example:

msbuild.exe MyProject.csproj /p:DeployOnBuild=true;PublishProfile=MyProfile

这篇关于如何配置MSBuild以将保存的publishProfile用于WebDeploy?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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