Can I use Web Config Transform without publish with Visual Studio 2012?

时间秒杀一切 提交于 2019-12-20 10:59:56

问题


Does Visual Studio 2012 support running a solution using a specific Web.config transform without the requirement to publish? We are using the web.config to change client settings on publish and want to test them locally.


回答1:


The web.config transform feature is only available during publish/package.

The deal with this is that web projects don't have the abstraction of an alternate folder where the app executes versus the folder where the source is located like win project have. Because of this a lot of VS code touches the source web.config. If the web.config file itself if modified without VS knowing it may lead to strange behavior.

I have blogged how you can manually do this at http://sedodream.com/2010/10/21/ASPNETWebProjectsWebdebugconfigWebreleaseconfig.aspx.

There has been a lot of people asking for this feature, even though it may put their web projects into a potentially bad state. Since the demand is soo high I am considering adding a gesture in SlowCheetah that will enable this for web projects as well. I've got an issue on the SlowCheetah project page at https://github.com/sayedihashimi/slow-cheetah/issues/39 to track this. You can follow that issue for further updates. This may be one of the next items that I work on, but in the mean time you can use the instructions at the link above.




回答2:


Not quite the same, but you can preview transformations using Visual Studio 2012+

Note: if you're using SlowCheetah you need to save the file before you preview.




回答3:


You should look into the SlowCheetah extension for VS. It enables XML transforms when you F5, in addition to publishing. It also enables transforms for more than just web.config.



来源:https://stackoverflow.com/questions/12177647/can-i-use-web-config-transform-without-publish-with-visual-studio-2012

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