开发者

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

开发者 https://www.devze.com 2023-01-14 19:04 出处:网络
The code for app.config is as below: <?xml version=\"1.0\" encoding=\"utf-8\" ?> <configuration>

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

精彩评论

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