VS编译完后,release版本的web.config(或者app.config) 为什么不一样那?

我们查看一下项目结构,会发现有两个版本的config文件存在:

打开web.Debug.config,这个文件没有什么,就是正常的配置。

打开web.Release.config文件,发现了奥秘。下面是VS自己默认创建的内容:

<?xml
version="1.0"
encoding="utf-8"?>

 

<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->

 

<configuration
xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

<!--

In the example below, the "SetAttributes" transform will change the value of

"connectionString" to use "ReleaseSQLServer" only when the "Match" locator

finds an attribute "name" that has a value of "MyDB".

 

<connectionStrings>

<add name="MyDB"

connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"

xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>

</connectionStrings>

-->

<system.web>

<!--

In the example below, the "Replace" transform will replace the entire

<customErrors> section of your web.config file.

Note that because there is only one customErrors section under the

<system.web> node, there is no need to use the "xdt:Locator" attribute.

 

<customErrors defaultRedirect="GenericError.htm"

mode="RemoteOnly" xdt:Transform="Replace">

<error statusCode="500" redirect="InternalError.htm"/>

</customErrors>

-->

</system.web>

</configuration>

 

仔细读一下,发现这里面给出了两个例子:

第一个例子是如何找到web.Debug.config文件中connectionStrings节点下面名字为MyDB的键,然后将内容替换成指定的内容。

第二个例子是如何将web.Debug.config文件中某个节点整体替换成指定的内容。

 

另外还可以看到给出了一个网址,可以参考进行更高级的操作:

http://schemas.microsoft.com/XML-Document-Transform

 

看到这里,就明白Release版本的web.config是怎么产生的了。

Web.config的Release版本和Debug版本不一样的奥秘的更多相关文章

  1. Release 版本和 Debug 版本

    什么是 Release 版本.Debug 版本? bug-缺陷,程序故障.而debug指的是排除缺陷,显然这个模式是面向开发者的. 而release是满足发布所用. Debug 和 Release,在 ...

  2. Flutter 发布APK时,release版本和debug版本的默认权限不同

    Flutter 发布APK时,release版本和debug版本的默认权限不同 @author ixenos 在调试模式下,默认情况下启用服务扩展和多个权限(在flutter中) 当您处于发布模式时, ...

  3. MFC中release版本和debug版本区别

    最近MFC写了个程序,生成release版,原来正常,后来删掉了些控件再编译运行,结果竟然报内存读写错误,debug却是正常的.后来将“Project   Settings”   中   “C++/C ...

  4. 最全Windows版本jemalloc库(5.2.1)及其使用:包含动态库和静态库、x86版本和x64版本、debug版本和release版本

    编写服务器程序时,需要频繁的申请和释放内存,长时间运行会产生大量的内存碎片,这就导致即使当前系统中的闲置内存还足够多,但也无法申请到大的连续可用的内存块,因为此时的物理内存已经千疮百孔像个马蜂窝.此外 ...

  5. VS编译静态库 .lib 其中Release 版本比Debug版本要大好多原因

    如果工程代码使用了: 把此选项关闭即可减少库大小不少:

  6. 【FlashPlayer】-Debug版本-开发人员推荐

    Adobe的Flash-Player的版本分为“普通版本”和“Debug版本”,后者可以协助开发者测试和调试程序. 那么,先给出Debug版本的下载地址:http://www.adobe.com/su ...

  7. 转:Transform Web.Config when Deploying a Web Application Project

    Introduction One of the really cool features that are integrated with Visual Studio 2010 is Web.Conf ...

  8. debug版本和release版本的区别?

    好久没有做web项目了,这项目完成了要发布网站,不好忘了 以前操作过的? 还好脑子还是有点印象 现还是 写个文档吧记录吧 免得 以后作别的了又忘了 那可不妙啊 网站发布步骤:1.先将

  9. 为Debug和Release分别设置Web.config

    需求:在开发asp.net应用程序时,往往想在debug和release环境下使用不同的配置,而web.config文件却只有一个 解决方案:可以在原来的web.config中写下debug环境下的配 ...

随机推荐

  1. 谨慎注意WebBrowser控件的DocumentCompleted事件

    引言 WebBrowser控件的DocumentCompleted事件一般就被认定为是在页面完全加载完毕后产生,而注释中也是这么写的: 但事实却并非如此. 首先它不一定会在完全加载完毕时才触发,有时就 ...

  2. INDY10的IDHttpServer应答客户端

    INDY10的IDHttpServer应答客户端 首先贴源码: procedure TIdHTTPResponseInfo.WriteContent; begin if not HeaderHasBe ...

  3. Property's synthesized getter follows Cocoa naming convention for returning

    Property's synthesized getter follows Cocoa naming convention for returning.   今天早上在整理代码的时候发现了如上警告. ...

  4. ios 获得通讯录中联系人的所有属性 亲测,可行 兼容io6 和 ios 7

    //获取通讯录中的所有属性,并存储在 textView 中,已检验,切实可行.兼容io6 和 ios 7 ,而且ios7还没有权限确认提示. -(void)getAddressBook { ABAdd ...

  5. Asp.Net Mvc3.0(MEF依赖注入实例)

    前言 在http://www.cnblogs.com/aehyok/p/3386650.html前面一节主要是对MEF进行简单的介绍.本节主要来介绍如何在Asp.Net Mvc3.0中使用MEF. 准 ...

  6. Smali基本语法

    .field private isFlag:z 定义变量 .method 方法 .parameter 方法参数 .prologue 方法开始 .line 12 此方法位于第12行 invoke-sup ...

  7. Android工具类 DateUtil,可以用它方便的进行日期的操作

    本文转载自:http://blog.csdn.net/xuduzhoud/article/details/27526177 全部代码如下: DateUtil.java package com.exam ...

  8. [转]mysql 存储过程中使用多游标

    From : http://www.netingcn.com/mysql-procedure-muti-cursor.html mysql的存储过程可以很方便使用游标来实现一些功能,存储过程的写法大致 ...

  9. django的权限认证:登录和退出。auth模块和@login_required装饰器

    在settings.py中配置LOGIN_URL参数: # 用户访问带有(@login_required)标签的页面(view)时,如果没有登录,就会跳转到LOGIN_URL(即登陆url). LOG ...

  10. IDEA 快速将spring boot项目打包成jar包,简单快速有效

    原文地址;https://blog.csdn.net/chen846262292/article/details/80701101  https://www.cnblogs.com/chrischen ...