Project '..\..\Common\Common.csproj' targets 'net5.0'. It cannot be referenced by a project that targets '.NETStandard,Version=v2.0'

Viewed 1648

I am creating an application using Xamarin.Forms, and in my solution I have three projects that are conflicting with Target Framework types when I run the build.

Solution Explorer

As shown in the image above, CommonTest is my Testing project, Common is what I am using as a library to store classes used, and SimTools is what I am working out of to create the app.

Visual Studio Error List

click to enlarge

Currently, when I try to add a reference in SimTools to the Common project to use the classes, I get the error: "Project '..\..\Common\Common.csproj' targets 'net5.0'. It cannot be referenced by a project that targets '.NETStandard,Version=v2.0'."

The SimTools project target framework is .NET Standard 2.0, and the Common and CommonTest projects' target framework is .NET 5.0.

I've tried many combinations of changing the target framework for the Common Projects (changing to .NET Core versions), and the SimTools project (.NET Standard versions).

Additionally, I've referred to Microsoft's documentation regarding what frameworks support one another, and these combinations still show errors when I try to build.

https://docs.microsoft.com/en-us/dotnet/standard/net-standard

What is the minimum target framework version I need to set for SimTools and Common to allow SimTools to have a reference to Common?

1 Answers

According to the Microsoft documentation on .NET Standard, .NET 5 implements .NET Standard 2.1.

However this means, if I'm not mistaken, that a .NET 5 project can reference a .NET Standard 2.1 (or lower) app, not the other way around.

Is there some reason you can't have your common project use .NET 5?

Related