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

1517 questions
917
votes
12 answers

What is the difference between .NET Core and .NET Standard Class Library project types?

In Visual Studio, there are at least three different types of class libraries you can create: Class Library (.NET Framework) Class Library (.NET Standard) Class Library (.NET Core) While the first is what we've been using for years, a major point…
Gigi
  • 24,295
  • 20
  • 85
  • 170
262
votes
7 answers

.NET Standard vs .NET Core

I have read about the difference between .NET Standard and .NET Core, but I really don't know what the difference is, or when to choose a .NET Standard library project and when to choose a .NET Core library project. I have read that .NET Standard is…
Álvaro García
  • 15,452
  • 25
  • 82
  • 152
182
votes
3 answers

Does C# 8 support the .NET Framework?

In Visual Studio 2019 Advanced Build settings, C# 8 does not appear to be available for a .NET Framework project, only (as in the picture below) for a .NET Core 3.0 project: Does C# 8 support the .NET Framework?
James Harcourt
  • 4,916
  • 4
  • 16
  • 35
175
votes
6 answers

Is ConfigurationManager.AppSettings available in .NET Core 2.0?

I've got a method that reads settings from my config file like this: var value = ConfigurationManager.AppSettings[key]; It compiles fine when targeting .NET Standard 2.0 only. Now I need multiple targets, so I updated my project file with:…
Alex Sanséau
  • 6,440
  • 3
  • 17
  • 24
165
votes
5 answers

Unit testing internal methods in VS2017 .NET Standard library

I am currently playing around with the latest Visual Studio 2017 Release Candidate by creating a .NET Standard 1.6 library. I am using xUnit to unit test my code and was wondering if you can still test internal methods in VS2017. I remember that you…
Phil Murray
  • 5,971
  • 8
  • 41
  • 85
136
votes
19 answers

What do Yellow Warning Triangles mean on Dependencies in Visual Studio 2017?

I have just converted my PCL library to a new .Net Standard library and I have some Yellow Warning triangles on my Dependencies shown below: During the conversion it brought all nuget packages across including dependencies so it could be…
user1
  • 15,594
  • 12
  • 96
  • 166
133
votes
8 answers

Should I take ILogger, ILogger, ILoggerFactory or ILoggerProvider for a library?

This may be somewhat related to Pass ILogger or ILoggerFactory to constructors in AspNet Core?, however this is specifically about Library Design, not about how the actual application that uses those libraries implement its logging. I am writing a…
Michael Stum
  • 167,397
  • 108
  • 388
  • 523
130
votes
19 answers

Auto Versioning in Visual Studio 2017 (.NET Core)

I have spent the better part of a few hours trying to find a way to auto-increment versions in a .NETCoreApp 1.1 (Visual Studio 2017). I know the the AssemblyInfo.cs is being created dynamically in the folder: obj/Debug/netcoreapp1.1/ It does not…
Jason H
  • 4,476
  • 5
  • 23
  • 39
108
votes
2 answers

What are .NET Platform Extensions on docs.microsoft.com?

There is a framework-level navigation element at Microsoft Docs called ".NET Platform Extensions". It contains docs on recently added APIs like System.IO.Pipelines and System.Threading.Channels for example, as well as a whole bunch of other APIs,…
Fit Dev
  • 2,733
  • 3
  • 19
  • 44
101
votes
3 answers

What are the application implications of a netstandard library depending on a metapackage?

Suppose I have a class library which I want to target netstandard1.3, but also use BigInteger. Here's a trivial example - the sole source file is Adder.cs: using System; using System.Numerics; namespace Calculator { public class Adder { …
Jon Skeet
  • 1,261,211
  • 792
  • 8,724
  • 8,929
74
votes
3 answers

Convert .NET Core 2.0 class libraries to .NET Standard

Is there a way to easily convert a class library targeting .NET Core 2.0 to .NET Standard? If I understand it correctly, if one wants to maximize the reusability of class libraries in projects targeting different .NET frameworks e.g. .NET Framework,…
Sam
  • 19,814
  • 35
  • 141
  • 272
61
votes
11 answers

Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.1.0.0

I have a .NET Standard 1.4 class library that references the System.ComponentModel.Annotations (4.3.0) NuGet package. I'm then referencing this class library from a .NET Framework 4.6.2 test project. It builds fine, but at runtime I get the…
Dan Ellis
  • 5,077
  • 7
  • 44
  • 71
56
votes
4 answers

Why does my .NET Standard NuGet package trigger so many dependencies?

I've been mucking about with a .NET Standard project and NuGet. I've got a working project and have uploaded it to NuGet.org. My project targets .NET Standard 1.3, which should support .NET Framework 4.6 and .NET Core 1.0. But when I tried to add my…
Tom Wright
  • 10,801
  • 12
  • 71
  • 138
47
votes
3 answers

How do I exclude files/folders from a .NET Core/Standard project?

In .NET Core and .NET Standard projects, if you put files and folders within the project directory, they are automatically picked up by Visual Studio; essentially they are part of the project. What if I have files/folders in there that aren't really…
Gigi
  • 24,295
  • 20
  • 85
  • 170
45
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,561
  • 1
  • 10
  • 25
1
2 3
99 100