如何在 web.config 转换过程中添加文件? [英] how to add files in web.config transformation process?

查看:33
本文介绍了如何在 web.config 转换过程中添加文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在 Visual Studio 2012 中开发的网站.web.config 当前在其转换中包含以下文件:- web.Debug.config- web.Release.config

I am having a website developed in Visual Studio 2012. The web.config is currently containing following files in its transformation: - web.Debug.config - web.Release.config

我最近在我的项目中添加了一个新的构建配置(名为Staging").如何创建web.Staging.config"转换文件?

I have recently added a new build configuration (named as "Staging") in my project. How can I create a "web.Staging.config" transformation file?

推荐答案

在 VS 中生成 web.config 转换文件有两种方式:

There are two ways for the web.config transform files to be generated within VS:

  1. 如果您有一个 Web 应用程序项目,右键单击 web.config 并选择添加配置转换.这将添加您的项目中缺少的任何配置转换基于构建配置(即,如果您有生产和暂存构建配置,两者都会添加转换).
    • 网站项目不支持此方法,因为它们不支持多个构建配置.
  1. If you have a web application project, Right-click on web.config and choose Add Config Transform. This will add any config transforms that are missing from your project based on build configurations (i.e. if you have Production and Staging build configs, both will get a transform added).
    • This method is not supported for Website projects as they do not support multiple build configurations.
  • 这需要 VS2012 Update 2 或适用于 VS2010 的 Azure SDK 2.0(我认为).
  • 在网站项目中,新的转换文件将不会嵌套在 web.config 下,因为 VS 不支持该行为.只需在根文件夹中查找即可.
  • This requires VS2012 Update 2 or the Azure SDK 2.0 for VS2010 (I think).
  • In a web site project, the new transform file will not be nested under web.config as VS doesn't support that behavior. Just look for it in the root folder.

这篇关于如何在 web.config 转换过程中添加文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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