Questions tagged [.net-standard]

The .NET Standard is a formal specification of .NET APIs that are intended to be available on all .NET runtimes. The motivation behind the .NET Standard is establishing greater uniformity in the .NET ecosystem. Consider tagging a more specific version of .NET Standard in your question.

The enables the following key scenarios:

  • Defines uniform set of APIs for all .NET platforms (, , ) to implement
  • Enables developers to produce portable libraries that are usable across .NET runtimes
  • Reduces and hopefully eliminates conditional compilation of shared source due to .NET APIs

Ref:

Related tags

1607 questions
55
votes
4 answers

How can I change a .NET standard library to a .NET framework library?

I'm writing a class library for a simple parser in C#. When I first created it, I used .NET standard 2.0, but now I need to migrate it to .NET 4.6 both to conform to the other projects in my solution and in order to use NUnit. I tried to follow the…
Edward Minnix
  • 2,889
  • 1
  • 13
  • 26
51
votes
10 answers

Type 'Object' is defined in an assembly that is not referenced (NET Standard 2.0/.NET Framework 4.6.1)

I'm using the .NET Standard 2.0 preview, on which my Class Libraries are based. After having trouble with a few NuGet packages, especially regarding archive extraction, I decided to migrate my .NET Core 2.0 Console projects back to the .NET…
jAC
  • 5,195
  • 6
  • 40
  • 55
50
votes
1 answer

Adding a bindingRedirect to a .Net Standard library

I have a .Net Standard library, and I'm getting an error when trying to use one of the dependant libraries, which I believe is down to a version conflict. In an old style .Net Class library, I might add something like this:
Paul Michaels
  • 16,185
  • 43
  • 146
  • 269
46
votes
2 answers

How to properly unit test a .NET project with multiple target frameworks, given implementation differences among targets?

Consider a .NET class library that targets the following frameworks: .NET Framework 2.0 .NET Framework 4.6 .NET Standard 1.0 .NET Standard 1.3 .NET Portable Profile336 Let's not immediately worry about why this is the exact list of target…
Joe Amenta
  • 4,662
  • 2
  • 29
  • 38
44
votes
7 answers

HttpContext in .net standard library

I am working on couple of projects one of which is an ASP.NET 4.5 application and other one is .Net Core API 1.1 project. The asp.net application is using HttpContext classes to read cookies and page headers. Now, I need to move this to a .net…
Kumar A
  • 441
  • 1
  • 4
  • 3
40
votes
1 answer

How can I get NUnit3TestAdapter to work with .Net Standard 2.0?

How can I get NUnit3TestAdapter to work with .Net Standard 2.0? I receive the following error: 1>C:\Nikeza\Mobile\Nikeza.Mobile\Tests\ExampleBased.fsproj : warning NU1701: Package 'NUnit3TestAdapter 3.9.0' was restored using …
Scott Nimrod
  • 11,206
  • 11
  • 54
  • 118
37
votes
2 answers

Project 'ClassLibrary1.csproj' targets 'netstandard2.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.8'

I have some class library projects in targets netstandard2.1. When I referenced that to my WPF project in target .NET Framework v4.8, On building time I get an error: Severity Code Description Project File Line Suppression State Error …
Behzad
  • 3,502
  • 4
  • 36
  • 63
36
votes
9 answers

'Could not load file or assembly 'netstandard, Version=2.0.0.0, ...'. Reference assemblies should not be loaded for execution

Goal: From a .NET 4.7 console app, using reflection with Assembly.GetType(), I am trying extract the Type of a netstandard 2.0 class from Assembly X. Then I want to create an instance of this Type with Activator.CreateInstance(). What I am trying…
35
votes
2 answers

How Do You Reference a .NET Standard Library from a .NET Framework 4.5 Console Application in Visual Studio 2017?

I have finally installed Visual Studio 2017.2 and am trying to get my first project working, but am running into some trouble that I hope to address here. I have a very simple .NET Standard Library described as the following project file:
Mike-E
  • 2,477
  • 3
  • 22
  • 34
33
votes
3 answers

Disable transitive project reference in .NET Standard 2

I'm writing an MVC website using ASP.NET Core 2.0. In the ASP.NET Core project (let's call it Web), I reference a .NET Standard 2 project in the same solution (let's call it Service). The Service project also references a third .NET Standard 2…
Emad
  • 3,809
  • 3
  • 32
  • 44
29
votes
4 answers

was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '

I am trying to reference a nuget package which is clearly .NetStandard2.0. We own the source code for this package and written it to target .netstandard. We do have a CI pipeline so that when we push this code, it builds and releases the nuget…
Lost
  • 12,007
  • 32
  • 121
  • 193
29
votes
4 answers

How to test .NET Standard 2 library with either NUnit, xUnit or MSTest from either Rider or VS 2017?

I have a project where I use Azure Durable Functions, and they are available only on .NET Standard 2. So, it defines which class library can be used in testing projects. But, I cannot put together a library where either xUnit, NUnit or MSTest is…
AndrasCsanyi
  • 3,943
  • 8
  • 45
  • 77
28
votes
1 answer

Compatibility shim used by .NET Standard 2.0

Overviews (example) of .NET Standard 2.0 say that it now uses some kind of compatibility shim that fixes the third-party library compatibility issue. So you can use the third-party library with .NET Standard until it doesn't use any API which .NET…
Set
  • 47,577
  • 22
  • 132
  • 150
27
votes
2 answers

Is There a Way to Force a Project Reference to .NET Standard Project to a Specific TargetFramework

I am a contributor to a GitHub project, and recently we had some trouble with our .NET Standard 2.0 project installing correctly into a .NET Framework 4.5 project. The cause of this is that (if I am understanding correctly) .NET Standard 2.0…
Mike-E
  • 2,477
  • 3
  • 22
  • 34
27
votes
5 answers

Could not load file or assembly "System.ValueTuple, Version=0.0.0.0" or one of its dependencies

I tried to update my project to .NET Standard 2.0 and during testing I got catch an exception: System.IO.FileLoadException: 'Could not load file or assembly "System.ValueTuple, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" or…
DmitrySpb
  • 381
  • 1
  • 4
  • 7