在 Visual Studio 2012 中,使用发布配置文件和 Web 部署可以大大简化部署。但是它仍然缺少一些东西,或者我可能还不知道如何使用它。
PublishProfileName.pubxml
我已经检查了源代码管理而不是 PublishProfileName.pubxml.user
对每个用户来说都是本地的?我至少可以保存用户名,但显然不想 checkin 。PublishProfileName.pubxml
的一部分但存储在 PublishProfileName.pubxml.user
如LastUsedBuildConfiguration
. 编辑
适合发布的命令行是
MSBuild.Exe MyProject.sln /p:Configuration=QA /p:DeployOnBuild=true;PublishProfile=PublishToQA;AllowUntrustedCertificate=true /p:authType=NTLM /p:UserName=
在此我想省略
/p:Configuration=QA
如果配置成为发布配置文件本身的一部分。
最佳答案
你的问题的一些答案。
- I prefer to use the NTLM authentication without storing the username and password (especially) in the publish profiles. How can this be done? If I leave the username and password empty, I am prompted for it. Is there a way like manually modifying the .pubxml files?
您的身份验证通常由托管 Web Deploy 的方式驱动。默认情况下,如果您使用 Web 管理服务,那么您将使用 IIS 用户进行身份验证。使用 IIS 用户,您可以控制哪些用户有权访问特定站点/应用程序。不过,您也可以将 WMSVC 配置为使用 Windows 身份验证。如果您在这些场景中使用 VS 时遇到问题,请告诉我。
如果您使用远程代理服务来托管 Web 部署,那么在这种情况下,您将使用 windows auth。
- Why is the username/password stored in
PublishProfileName.pubxml
that I have checked in the source control and not inPublishProfileName.pubxml.user
that is local to each user? I could at least save the username but obviously don't want that to be checked in.
我们有另一种机制供您确定哪些信息是私有(private)/共享的。除密码外,所有发布信息都是共享的(并且默认 checkin )。为了简化设计,您可以拥有一个共享的发布配置文件,或者一个根本不共享的发布配置文件。在您的个人资料中,不存在共享某些字段而其他字段不共享的配置文件。密码在此处是特殊情况,并在 .pubxml.user 文件中基于每个用户/每台机器进行加密。
如果您想要一个私有(private)发布配置文件,那么您可以简单地不 checkin 与发布配置文件对应的 .pubxml 文件。这些存储在 Properties\PublishProfiles(或 My Project\PublishProfiles for VB)中,只是将它们从项目中排除,而不是将文件 checkin 。发布对话框查找磁盘上的配置文件,而不仅仅是其中的配置文件该项目。一切都应该继续工作。
我们不支持在 .pubxml.user 文件中选择性地存储值的概念。发布对话框只会在该文件中存储一定数量的值。代替
- The Configuration itself is not part of
PublishProfileName.pubxml
but is stored inPublishProfileName.pubxml.user
asLastUsedBuildConfiguration
.- Same for the Platform as last point.
这是一个错误,它应该存储在 .pubxml 文件中,而不是 .pubxml.user 文件中。我们已经修复了这个问题,但还没有机会发布更新。
无法在发布配置文件中设置配置属性。 Configuration 属性是构建过程的核心部分。更具体地说,我们之所以没有调用此属性 Configuration 是因为 .pubxml 文件在构建和发布期间被导入到 .csproj/.vbproj 的定义中。由于其他属性是基于配置定义的,因此一旦设置该值,您将无法更改该值。我刚刚在 http://sedodream.com/2012/10/27/MSBuildHowToSetTheConfigurationProperty.aspx 上写了关于这个主题的太多细节的博客。 .此限制是 MSBuild 的事情,而不是发布限制。对于命令行,您应该通过以下方式指定配置:
msbuild.exe myproj.csproj/p:...(其他属性).../p:Configuration=
- I am also missing support for multi-server deployments. I am currently forced to use batch files in addition to Publish Profiles.
我们对此没有直接支持,但如果您扩展您的需求,我可能会提供帮助。仅供引用,我有一个您可能感兴趣的扩展程序。我已将 5 分钟视频发布到 http://sedodream.com/2012/03/14/PackageWebUpdatedAndVideoBelow.aspx .
关于msbuild - 如何配置发布配置文件以使用 NTLM 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13019505/