App.config Examples

fROM: http://blogs.msdn.com/suzcook/archive/2004/05/14/132022.aspx

Below are three examples of useful application configuration files.

  1. Forces the v1.0 CLR to be run. If the v1.0 CLR is not installed, the app will fail to run.

    <?xml version ="1.0"?>  <configuration>     <startup>          <requiredRuntime version="v1.0.3705"/>          <supportedRuntime version="v1.0.3705"/>      </startup>  </configuration>

  2. Redirects “assemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=25283151a234958d“ to version 2.0.0.0 of that assembly. This is only useful for strongly-named assemblies, since versions don't matter for those that are simply-named.

    <?xml version ="1.0"?> <configuration> <runtime>

            <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

                    <dependentAssembly>                         <assemblyIdentity name="assemblyName" culture="" publicKeyToken="25283151a234958d"/>                         <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>

                    </dependentAssembly>         </assemblyBinding>

    </runtime> </configuration>

  3. Redirects “assemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8968ee41e78ce97a“ to codebase “http://www.yourwebsite.com/filename.dll“. 'Href' can also be set to something like “file:///c:/localfile/filename.dll“. Note that redirecting to a codebase causes a System.Net.WebPermission or System.IO.FileIOPermissionAccess.Read + PathDiscovery demand when loading that assembly.

    <?xml version ="1.0"?> <configuration> <runtime>

            <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

                    <dependentAssembly>                         <assemblyIdentity name="assemblyName" culture="" publicKeyToken="8968ee41e78ce97a"/>                         <codeBase version="1.0.0.0" href="http://www.yourwebsite.com/filename.dll"/>

                    </dependentAssembly>         </assemblyBinding>

    </runtime> </configuration>

    •  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值