I have 2 projects in a solution, and I am not sure why I am running into this error for the 1st project when building the solution.
Error CS0579 Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute'
I've tried the following answer, Cleaned and Rebuilt, but it didn't help.
Add the following two lines to the <PropertyGroup>
.
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
</PropertyGroup>
And this answer says to delete the assemeblyinfo.cs file from project under properties menu and rebuild it, but I don't even see an Assemblyinfo.cs file under properties...
I've also commented out the assembly line per a different answer, and still it failed:
// <autogenerated />
using System;
using System.Reflection;
//[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]
Here are my .csproj files:
Project1:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.10" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DI\DI.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="HttpTrigger1/readme.md">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
Project2:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.6.0" />
<PackageReference Include="Azure.Storage.Queues" Version="12.6.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DI\DI.csproj" />
</ItemGroup>
</Project>