开发者

How can I search the Version of the application from app.config in c#?

The code for app.config is as below:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="conString" connectionString="Server= localhost;Database=OrderDetails;User Id=sa;Password=test;Trusted_Connection=false" />
  </connectionStrings>
  <system.web>
    <membership defaultProvider="ClientAuthenticationMembershipProvider">
      <providers>
        <add name="ClientAuthenticationMembershipProvider"
             type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, 
             System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
             serviceUri="" />
      </providers>
    </membership>
    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
      <providers>
        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider,
             System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyTo开发者_如何学Goken=31bf3856ad364e35"
             serviceUri="" cacheTimeout="86400" />
      </providers>
    </roleManager>
  </system.web>
</configuration>

How can i retrieve the Version using C# i.e, 3.5.0.0 as you can see in <add> tag? Please help me.


var assembly = System.Reflection.Assembly.GetExecutingAssembly();
var version = assembly.GetName().Version;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜