简体   繁体   English

web.config,web.debug.config,web.release.config&Publish vs Debug?

[英]web.config, web.debug.config, web.release.config & Publish vs Debug?

I've been trying to understand how to use the different config files and I just found this link which has been very helpful. 我一直在努力了解如何使用不同的配置文件,我刚刚发现这个链接非常有帮助。 The only problem is, that it seems the transforms only get taken into account when you 'publish' the solution and not if you just do a generic Debug or Run now. 唯一的问题是,当您'发布'解决方案时,似乎只会考虑转换,而不是如果您只是执行通用调试或立即运行。

Generally this wouldn't be to much of a problem, but I'm developing towards Windows Azure, which only allows you to publish to the Cloud. 一般来说,这不是一个大问题,但我正在向Windows Azure开发,它只允许您发布到云。 For general debugging I would rather run it locally within the Azure Emulator, but doing so does not 'process' my transforms. 对于一般调试,我宁愿在Azure模拟器中本地运行它,但这样做不会“处理”我的变换。

Is there any known workaround to have them transformed during a debugging session? 在调试会话期间是否有任何已知的解决方法可以将它们转换?

Edit: ShawnC pointed me to this question. 编辑:ShawnC向我指出了这个问题。

Which lead me to this extension. 这导致我这个扩展。 I think this will do the job! 我认为这将完成这项工作!

You can perform web.config transforms using msbuild. 您可以使用msbuild执行web.config转换。 You could put this in your project's AfterBuild target to aid your debugging. 您可以将它放在项目的AfterBuild目标中以帮助您进行调试。

You need to look at the TransformXml msbuild target, passing in: Source=path_to_your/web.config Transform=path_to_your/web.$(ConfigurationName).config and Destination=path_to_your/web.config 您需要查看TransformXml msbuild目标,传入: Source=path_to_your/web.config Transform=path_to_your/web.$(ConfigurationName).configDestination=path_to_your/web.config

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM