Link build configuration to a publish profile

和自甴很熟 提交于 2019-12-30 02:37:09

问题


Why does Microsoft not allow you to link a build configuration to a publish profile. Instead it tells you to use the dropdown in the main VS interface.

I find this extremely annoying, because we use config transforms to change our config settings based on the environment we are publishing to (such as database connection strings). We also check-in the .Publish.xml file, so that the publish paths are saved in source control. If someone forgets to change the build configuration they could accidentally publish test to production or vice versa. If we could check in the build configuration selection with the publish profile we would not have this issue.

Does anyone know if Microsoft plans on changing this in the future?


回答1:


By pure luck, I found this:

http://blogs.msdn.com/b/webdev/archive/2012/06/15/visual-studio-2010-web-publish-updates.aspx

If you install this update (related to Azure), then the publishing tools are updated to a wizard type interface that DOES tie a publish profile to a specific build configuration.

I don't really understand why this is tied to Azure, but it works perfectly for all types of publishing (I use the publish to a folder option). No more publishing with the wrong build configuration!




回答2:


To get around this, you can write a batch script to do both parts of the process. Use MSBuild to build your projects in the required build configuration (we use release for our web apps). If all you need to do is copy the output, MSBuild should be able to do that for you as well with a copy task. If you need to deploy a web application, use MSDeploy command line tools to complete the publish command. Going command line with both of these tools opens up a lot of customization.




回答3:


I very much agree that this should be implemented. It's currently very easy to make fatal mistakes when publishing.

Seems like this will be (/has been) fixed for Visual Studio 11 but won't be changed for Visual Studio 2010: https://connect.microsoft.com/VisualStudio/feedback/details/690284/publish-profiles-do-not-include-build-configuration



来源:https://stackoverflow.com/questions/5410278/link-build-configuration-to-a-publish-profile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!