代码之家  ›  专栏  ›  技术社区  ›  DaveDev

为什么我的解决方案认为这个项目的操作系统版本是0.0.0.0,如何解决?

  •  0
  • DaveDev  · 技术社区  · 4 年前

    我有一个项目(IdentityServer4-我从GitHub获取的),我正在引用另一个项目。当我尝试运行项目时,出现以下错误:

    错误CS1705程序集'IdentityServer4.EntityFramework'with identity' IdentityServer4.EntityFramework,版本=3.1.3.0 IdentityServer4,版本=0.0.0.0 ,区域性=中性,PublicKeyToken=f294d0afe402bb2b'

    唯一有效的方法是在IdentityServer4项目中手动指定版本装配信息.cs, [assembly: AssemblyVersion("4.0.0.0")]

    但有一半的时间(我不知道为什么不是所有的时间),我会遇到这样的错误:

    错误CS0579重复'System.Reflection.AssemblyVersionAttribute组件'属性IdentityServer4 1\IdentityServer4。装配信息.cs21激活

    并用

    //------------------------------------------------------------------------------
    // <auto-generated>
    //     This code was generated by a tool.
    //     Runtime Version:4.0.30319.42000
    //
    //     Changes to this file may cause incorrect behavior and will be lost if
    //     the code is regenerated.
    // </auto-generated>
    //------------------------------------------------------------------------------
    
    using System;
    using System.Reflection;
    
    [assembly: System.Reflection.AssemblyCompanyAttribute("Brock Allen;Dominick Baier")]
    [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
    [assembly: System.Reflection.AssemblyDescriptionAttribute("OpenID Connect and OAuth 2.0 Framework for ASP.NET Core")]
    [assembly: System.Reflection.AssemblyFileVersionAttribute("0.0.0.0")]
    [assembly: System.Reflection.AssemblyInformationalVersionAttribute("0.0.0-alpha.0.26+6d2fb71321570b26f1cdaa22d5d339cf67373b94")]
    [assembly: System.Reflection.AssemblyProductAttribute("IdentityServer4")]
    [assembly: System.Reflection.AssemblyTitleAttribute("IdentityServer4")]
    [assembly: System.Reflection.AssemblyVersionAttribute("0.0.0.0")]
    
    // Generated by the MSBuild WriteCodeFragment class.
    

    --为什么开发环境认为IdentityServer4是版本0.0.0.0,而不管我指定的版本是什么?

    --正确的解决方法是什么?

    1 回复  |  直到 4 年前
        1
  •  0
  •   Sotiris Koukios-Panopoulos    4 年前

    它也写在GitHub存储库的“如何构建”部分:

    • 安装所需的.NET Core SDK
    • build.ps1 build.sh 在回购的根源

    这将在解决方案的所有项目中正确设置版本,应该可以解决您的问题。