Version number in .NET Compact Framework application

后端 未结 4 1826
旧巷少年郎
旧巷少年郎 2021-02-10 00:35

I need to display the .NET Compact Framework version number on the screen. I am using .NET CF 2.0 with Windows CE 4.0.

So far, I have been ignoring the version numb

4条回答
  •  情书的邮戳
    2021-02-10 00:46

    To display the product version with .NET Compact Framework ( tested with with 2.0 and 3.5 ), you can use AssemblyHelper.getProductVersion() defined below.

    For example, if the assembly version is defined like below in AssemblyInfo.cs file, the result of the method is "1.2.3".

    Extract of AssemblyInfo.cs file :

    [assembly: AssemblyVersion("1.2.3")]
    

    Extract of AssemblyHelper.cs file :

    using System;
    using System.Reflection;
    
    public static class AssemblyHelper
    {
      public static string getProductVersion()
      {
        Version assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version;
        return String.Format("{0}.{1}.{2}", assemblyVersion.Major, assemblyVersion.Minor, assemblyVersion.Build);
      }
    }
    

提交回复
热议问题