如何使用 Visual Studio 网站项目进行 Web.config 转换? [英] How do I do Web.config Transformations with Visual Studio Website Projects?

查看:47
本文介绍了如何使用 Visual Studio 网站项目进行 Web.config 转换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎不可能更改Visual的构建配置Studio 2010 网站项目(与 Visual Studio Web 应用程序相对),并且更改构建配置是启用 Web.config 转换的关键部分(除了调试之外,无法将配置更改为任何配置).

It doesn't seem to be possible to change the Build Configuration of Visual Studio 2010 Website Projects (as opposed to Visual Studio Web Applications), and changing the Build Configuration is a key part of enabling Web.config transformations (it's not possible to change the configuration to anything except Debug).

如果无法更改构建配置,如何让 Web.config 转换与 Visual Studio 2010 网站项目一起使用?

How do I get Web.config transformations to work with Visual Studio 2010 Website projects if it's not possible to change the Build Configuration?

推荐答案

我在这里找到了一篇很好的博客文章,描述了一个解决方案:http://andrewtwest.com/2010/02/25/using-web-config-transformations-in-web-site-projects/

I found a pretty good blog post describing a solution to this here: http://andrewtwest.com/2010/02/25/using-web-config-transformations-in-web-site-projects/

简而言之:在包含该网站的解决方案中创建一个空项目(只要它不是另一个网站项目).空项目将允许您通过其项目文件访问 msbuild,这将允许您在您的网站 web.config 上执行转换.

In short: create an empty project (as long as it is not another website project) in your solution that contains the website. The empty project will give you access to msbuild through its project file, which will allow you to perform transforms on your website web.config.

这篇关于如何使用 Visual Studio 网站项目进行 Web.config 转换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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