I have a project in which i was trying to introduce the .netstandard 2.0 into. But my problem is that i cannot find the [proper way to download this package to my Visual Studio. Can someone walk me through this steps? Thanks. Markus
Severity Code Description Project File Line Suppression State Error Project '..\Logger\Logger.csproj' targets 'netstandard2.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v2.0'. Web
the github project is just the api specification, not code. you do not reference it. to create a .netstandard library with visual studio, create class library -> .net standard.
.net standard libraries use a different project format from 4.* library projects. to convert a 4.* library to .net standard, you need a new project file. the easiest is to create a new .net standard project and add the files to the project. unlike old projects,
the files must be in the project folder or a child of the project folder. the files are not specified in the project file, globing is used to find them.
to add a .net standard library project to an existing project, you just add a project reference.
Hello mgebhard, here is an update to a project that you assisted me with. I now have the ability to post my project on Git Hub. So can you help me to find out why i was receiving the error we were working on! Thanks, Markus.
GitHub to project:
https://github.com/Andrew112/EmployeePortal.git
Error!
Severity Code Description Project File Line Suppression State
Error Project '..\Logger\Logger.csproj' targets 'netstandard2.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v2.0'. Web
Hello mgebhard, here is an update to a project that you assisted me with. I now have the ability to post my project on Git Hub. So can you help me to find out why i was receiving the error we were working on! Thanks, Markus.
It is the same issue as before. The logger library targets netstandard 2 but you web project targets a .NET framework version that is not compatible with netstandard 2.0. See the netstandard documentation.
to reference a .netstandard 2.0 project from a 4.* project, the referencing project must target 4.6.1 framework or greater. your GitHub web project targets version 2.0 (way too old).
Why are you targeting framework 2.0? Support ended in 2011. For support you need to be on at least 4.5.2. But you should be using 4.8, which is the end of the line line for the .net classic versions.
Bruce, whenever i try to target anything above 2.0 i still get the error! This is when im trying to upgrade to another target framework. Its almost like the project is missing a package or something! Markus
There are issues with the old 4.6.1 and .net standard, you should at a minimum use 4.7.*, or better yet 4.8.*. If it’s as appears, it’s a new project, why isn’t it core? Why create new projects with an obsolete framework?
Member
251 Points
423 Posts
.netstandard 2.0
Nov 21, 2019 09:02 PM|Markus33|LINK
I have a project in which i was trying to introduce the .netstandard 2.0 into. But my problem is that i cannot find the [proper way to download this package to my Visual Studio. Can someone walk me through this steps? Thanks. Markus
https://github.com/dotnet/standard/blob/master/docs/versions/netstandard2.0.md
I am trying to correct the following error:
Severity Code Description Project File Line Suppression State
Error Project '..\Logger\Logger.csproj' targets 'netstandard2.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v2.0'. Web
All-Star
53051 Points
23632 Posts
Re: .netstandard 2.0
Nov 21, 2019 09:23 PM|mgebhard|LINK
The error message indicates you project targets ASP.NET 2.0. You'll need to upgrade to your 2.0 project to at least 4.6.1.
https://docs.microsoft.com/en-us/dotnet/standard/net-standard
All-Star
58204 Points
15665 Posts
Re: .netstandard 2.0
Nov 21, 2019 09:27 PM|bruce (sqlwork.com)|LINK
the github project is just the api specification, not code. you do not reference it. to create a .netstandard library with visual studio, create class library -> .net standard.
.net standard libraries use a different project format from 4.* library projects. to convert a 4.* library to .net standard, you need a new project file. the easiest is to create a new .net standard project and add the files to the project. unlike old projects, the files must be in the project folder or a child of the project folder. the files are not specified in the project file, globing is used to find them.
to add a .net standard library project to an existing project, you just add a project reference.
Member
251 Points
423 Posts
Re: .netstandard 2.0
Nov 29, 2019 07:51 PM|Markus33|LINK
Hello mgebhard, here is an update to a project that you assisted me with. I now have the ability to post my project on Git Hub. So can you help me to find out why i was receiving the error we were working on! Thanks, Markus.
GitHub to project:
https://github.com/Andrew112/EmployeePortal.git
Error!
Severity Code Description Project File Line Suppression State
Error Project '..\Logger\Logger.csproj' targets 'netstandard2.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v2.0'. Web
All-Star
53051 Points
23632 Posts
Re: .netstandard 2.0
Nov 29, 2019 10:14 PM|mgebhard|LINK
It is the same issue as before. The logger library targets netstandard 2 but you web project targets a .NET framework version that is not compatible with netstandard 2.0. See the netstandard documentation.
https://docs.microsoft.com/en-us/dotnet/standard/net-standard
I recommend creating a .NET framework library rather than netstandard.
All-Star
58204 Points
15665 Posts
Re: .netstandard 2.0
Nov 30, 2019 01:39 AM|bruce (sqlwork.com)|LINK
to reference a .netstandard 2.0 project from a 4.* project, the referencing project must target 4.6.1 framework or greater. your GitHub web project targets version 2.0 (way too old).
Member
251 Points
423 Posts
Re: .netstandard 2.0
Nov 30, 2019 06:05 PM|Markus33|LINK
Gebhard, can you walk me through how to create library .Net Framework library class in visual studio. Thanks, Markus
All-Star
58204 Points
15665 Posts
Re: .netstandard 2.0
Nov 30, 2019 07:31 PM|bruce (sqlwork.com)|LINK
Why are you targeting framework 2.0? Support ended in 2011. For support you need to be on at least 4.5.2. But you should be using 4.8, which is the end of the line line for the .net classic versions.
Member
251 Points
423 Posts
Re: .netstandard 2.0
Nov 30, 2019 09:50 PM|Markus33|LINK
Bruce, whenever i try to target anything above 2.0 i still get the error! This is when im trying to upgrade to another target framework. Its almost like the project is missing a package or something! Markus
All-Star
58204 Points
15665 Posts
Re: .netstandard 2.0
Dec 01, 2019 12:02 AM|bruce (sqlwork.com)|LINK
There are issues with the old 4.6.1 and .net standard, you should at a minimum use 4.7.*, or better yet 4.8.*. If it’s as appears, it’s a new project, why isn’t it core? Why create new projects with an obsolete framework?