Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute code example

Example 1: Error CS0579 Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute MyUIApp D:\MyUIApp\obj\Debug\netcoreapp3.1\.NETCoreApp,Version=v3.1.AssemblyAttributes.cs 4 Active

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

Example 2: while coding c# i get the error : "Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute [first_better_project]"

<Project>
  <PropertyGroup>
    <BaseIntermediateOutputPath>obj\$(TargetFramework)</BaseIntermediateOutputPath>
    <MSBuildProjectExtensionsPath>obj\</MSBuildProjectExtensionsPath>
  </PropertyGroup>
  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

  <PropertyGroup>
    <TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <AssemblyName>Foo</AssemblyName>
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
    <OutputPath>..\..\Builds\$(TargetFramework)\$(Configuration)\</OutputPath>
    <WarningLevel>4</WarningLevel>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>

  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>

Example 3: while coding c# i get the error : "Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute [first_better_project]"

<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>

Example 4: while coding c# i get the error : "Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute [first_better_project]"

<ItemGroup>
  <DefaultItemExcludes>$(DefaultItemExcludes);obj/**</DefaultItemExcludes>
</ItemGroup>