gpt4 book ai didi

visual-studio-2017 - VS 2017 构建错误 - AssemblyInfo.cs 中的重复属性

转载 作者:行者123 更新时间:2023-12-04 11:00:49 24 4
gpt4 key购买 nike

我正在开发一个 Web 应用程序,它通过运行 dotnet new angular 开始了生活。 ( Clear blog explanation of usage )。

为了扩展默认代码的功能,我开始开发 Web API。我添加了 3 个新的 .Net 核心库项目,名为 Shared , SchedulingScheduling_Tests .

一些领域模型类在 Scheduling 中定义, 一些基类在 Shared 中定义最后在 ShedulingTests 中定义了一些 NUnit 测试.

当我构建解决方案时,我的 Web 应用程序项目中会出现 2 个新文件夹:SharedScheduling .我还收到如下构建错误:

Error   CS0579  Duplicate 'System.Reflection.AssemblyCompanyAttribute'

我不知道用这个去哪里,任何建议都会非常受欢迎。

最佳答案

发生这种情况是因为新的 .NET 工具会自动创建属性并将它们添加到程序集中,因此它们现在在构建中出现两次。

有两种方法可以修复它:

  • 删除 AssemblyInfo.cs
  • 保留 AssemblyInfo.cs,但将标记添加到您的 CSProj 文件以抑制 AssemblyInfo 中的属性。

  • 例如:

    <属性(property)组>
    netstandard2.0
    false
    false
    false
    false
    false
    false
    false


    (感谢 https://johnkoerner.com/csharp/dealing-with-duplicate-attribute-errors-in-net-core/)

    关于visual-studio-2017 - VS 2017 构建错误 - AssemblyInfo.cs 中的重复属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45349981/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com