相关疑难解决方法(0)

错误 CS0579 重复 'global::System.Runtime.Versioning.TargetFrameworkAttribute'

当我构建我的应用程序时,我收到以下错误

 Error  CS0579  Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute    MyUIApp
D:\MyUIApp\obj\Debug\netcoreapp3.1\.NETCoreApp,Version=v3.1.AssemblyAttributes.cs   4   Active
Run Code Online (Sandbox Code Playgroud)

obj/Debug/netcoreapp3.1文件夹下自动生成以下代码

// 使用系统;使用 System.Reflection; [程序集: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]

我有一个以开头的项目文件

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <OutputType>Library</OutputType>
    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <RestorePackages>true</RestorePackages>
    <UseWindowsForms>true</UseWindowsForms>
  </PropertyGroup>
  <PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

我可以通过注释掉文件的内容来解决这个问题,但不能通过删除文件来解决。

netcoreapp3.1

39
推荐指数
8
解决办法
3万
查看次数

标签 统计

netcoreapp3.1 ×1