【问题标题】:How to make all the project in my solution to have same product version on shared assemblyVersion ?如何使我的解决方案中的所有项目在共享 assemblyVersion 上具有相同的产品版本?
【发布时间】:2017-07-03 05:33:23
【问题描述】:

我在解决方案中的所有项目之间使用对 AssemblyInfo.cs 的共享引用,并将 AssemblyVersion 设置为 ("1.0.*")

每个项目输出文件(dll/exe)都包含不同的文件版本。

我希望在所有程序集上都有这个文件版本相同,而不是像现在这样不同。

但我想使用相同的默认内部版本号(使用 ("1.0.*"))

怎么做?

【问题讨论】:

    标签: c# visual-studio


    【解决方案1】:

    在我的解决方案中,这是通过创建单独的程序集信息文件(我们称之为 GlobalAssemblyInfo.cs)并将其添加到解决方案中的每个项目作为参考来实现的。不过,您应该从每个 AssemblyInfo.cs 文件中删除程序集属性。

    using System.Reflection;
    
    [assembly: AssemblyCompany("Company name")]
    
    [assembly: AssemblyCopyright("Copyright")]
    
    // 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 Revision and Build  Numbers 
    // by using the '*' as shown below:
    
    [assembly: AssemblyVersion("1.9.0.24850")]
    

    当您将现有项目添加到项目时,您可以选择“添加”按钮“添加为链接”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-09
      • 1970-01-01
      • 2010-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多