locked
.netstandard 2.0 RRS feed

  • Question

  • User1421620300 posted

    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

    Thursday, November 21, 2019 9:02 PM

Answers

  • User475983607 posted

    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

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 21, 2019 9:23 PM
  • User-474980206 posted

    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.  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 21, 2019 9:27 PM
  • User475983607 posted

    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.

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

    I recommend creating a .NET framework library rather than netstandard.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 29, 2019 10:14 PM
  • User-474980206 posted

    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).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 30, 2019 1:39 AM
  • User-474980206 posted

    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. 


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 30, 2019 7:31 PM
  • User-474980206 posted

    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?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, December 1, 2019 12:02 AM

All replies

  • User475983607 posted

    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

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 21, 2019 9:23 PM
  • User-474980206 posted

    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.  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 21, 2019 9:27 PM
  • User1421620300 posted

    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

    Friday, November 29, 2019 7:51 PM
  • User475983607 posted

    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.

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

    I recommend creating a .NET framework library rather than netstandard.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 29, 2019 10:14 PM
  • User-474980206 posted

    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).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 30, 2019 1:39 AM
  • User1421620300 posted

    Gebhard, can you walk me through how to create library .Net Framework library class in visual studio. Thanks, Markus

    Saturday, November 30, 2019 6:05 PM
  • User-474980206 posted

    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. 


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 30, 2019 7:31 PM
  • User1421620300 posted

    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

    Saturday, November 30, 2019 9:50 PM
  • User-474980206 posted

    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?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, December 1, 2019 12:02 AM