Duplicate AssemblyVersion Attribute

前端 未结 21 1561
暖寄归人
暖寄归人 2020-12-02 11:07

I have a project that generates following error on compilation:

error CS0579: Duplicate \'AssemblyVersion\' attribute

I have che

相关标签:
21条回答
  • 2020-12-02 11:29

    I have also run into this issue in the past, so I am going to assume that your build process provides assembly information separately to providing versioning. And that causes a duplication as your project also has that info in the AssemblyInfo.cs file. So remove the file and I think it should work.

    0 讨论(0)
  • 2020-12-02 11:30

    In my case, some temporary *.cs files generated during compilation got accidentally added to the project.

    The files were from the obj\Debug directory, so they definitely shouldn't have been added to the solution. A *.cs wildcard went a little crazy and added them incorrectly.

    Deleting these files fixed the problem.

    0 讨论(0)
  • 2020-12-02 11:31

    This issue is a reference conflict which is mostly peculiar to VS 2017.

    I solved this same error by simply commenting out lines 7 -14 as well as Assembly version codes at the bottom of the page on AssemblyInfo.cs

    It removed all the duplicate references and the project was able to build again.

    0 讨论(0)
  • 2020-12-02 11:31

    I had to delete the whole repo and clone a fresh copy to get it to work.

    I tried deleting all the files mentioned above but it didn't work.

    0 讨论(0)
  • 2020-12-02 11:32

    In my case, there where a subfolder in a project that was a project folder it self:

    • file system:

      • c:\projects\webapi\wepapi.csproj
      • c:\projects\webapi\tests\wepapitests.csproj
    • solution

      • webapi (folder and project)
        • tests (folder)
      • tests (folder and project)

    Then i had to remove the subfolder "tests" from the "webapi" project.

    0 讨论(0)
  • 2020-12-02 11:35

    Yet another solution when upgrading core to VS2017 is to remove them in the properties\assemblyinfo.cs file.

    Since they now are stored in the project.

    0 讨论(0)
提交回复
热议问题