Search code examples
c#.netvisual-studio-2019.net-standardlayered

Creating a project in Visual Studio with Windows Forms and the .NET Framework


I've been trying to create a new project with the layered architecture using layers like: Presentation (Windows Forms Application with .NET Framework), Data (Class Library), Common (Class Library) and Domain (Class Library). When referencing my Presentation layer to the domain layer and common layer, an error like the following occurs that I don't know what it means and I don't know how to fix it: There is no feedback from the visual studio on the error

Also if I want to run or clean the project an error appears that mentions the following:

Project "..\Dominio\Dominio.csproj" has "net6.0" as target. You cannot reference this a project with ".NET Framework,Version=v4.7.2" as the target. Presentation

How can I fix the problem?

I have tried to change the version of .NET in each layer of the project, besides that I have repeated the same procedure several times creating the project from 0.


Solution

  • .Net 6 is based on .Net Core. you cannot refer to a .net framework class library in a .Net 5 or 6 project. So you should create a .Net standard library if you want it to be referred to in both the .Net framework and .net core framework.

    Here is the list of compatible versions.