【问题标题】:Give Version number to a windows service C#为 Windows 服务 C# 提供版本号
【发布时间】:2017-10-17 20:10:24
【问题描述】:

我做了一个windows服务。我想为它分配一个版本号。我已经检查了关于这个的其他一些问题(Example)。但是在我的项目中,没有属性文件。所以,我做了以下步骤

  • 右键单击项目名称
  • 点击“属性”
  • 在“发布”类别下分配的版本号
  • 点击“立即发布”

完成上述步骤后,我的项目中已经创建了一个“Properties”文件夹,其中包含app.manifest文件。即使再次编译服务后,我也看不到版本号(版本号仍然是0.0.0.0

PS:这是我第一次尝试做版本控制。

【问题讨论】:

    标签: c# windows windows-services version versioning


    【解决方案1】:

    在 Properties AsemblyInfo.cs 中,您可以设置版本以及与您的程序集相关的所有内容

    [assembly: AssemblyTitle("Title")]
    [assembly: AssemblyDescription("******")]
    [assembly: AssemblyConfiguration("")]
    [assembly: AssemblyCompany("*********")]
    [assembly: AssemblyProduct("*******")]
    [assembly: AssemblyCopyright("*******")]
    [assembly: AssemblyTrademark("")]
    [assembly: AssemblyCulture("")]
    
    // Setting ComVisible to false makes the types in this assembly not visible 
    // to COM components.  If you need to access a type in this assembly from 
    // COM, set the ComVisible attribute to true on that type.
    [assembly: ComVisible(false)]
    
    
    
    // Version information for an assembly consists of the following four values:
    //
    //      Major Version
    //      Minor Version 
    //      Build Number
    //      Revision
    //
    // You can specify all the values or you can default the Build and Revision Numbers 
    // by using the '*' as shown below:
    // [assembly: AssemblyVersion("1.0.*")]
    [assembly: AssemblyVersion("3.0.0.37")]
    [assembly: AssemblyFileVersion("3.0.0.37")]
    [assembly: InternalsVisibleTo("*******")]
    

    【讨论】:

    • 我的属性文件夹中没有“AsemblyInfo.cs”。我需要自己创建“AsemblyInfo.cs”吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-09
    • 1970-01-01
    相关资源
    最近更新 更多