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
1009
votes
13 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
  • 28,163
  • 29
  • 106
  • 188
280
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
  • 18,114
  • 30
  • 102
  • 193
247
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
  • 6,017
  • 4
  • 22
  • 42
207
votes
7 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…
Alex Sanséau
  • 8,250
  • 5
  • 20
  • 25
204
votes
24 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…
JKennedy
  • 18,150
  • 17
  • 114
  • 198
200
votes
12 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
  • 177,530
  • 117
  • 400
  • 535
178
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
  • 6,396
  • 9
  • 45
  • 95
153
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
  • 3,413
  • 3
  • 30
  • 54
146
votes
21 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,996
  • 6
  • 27
  • 49
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,421,763
  • 867
  • 9,128
  • 9,194
84
votes
15 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,537
  • 8
  • 47
  • 73
75
votes
4 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
  • 26,817
  • 58
  • 206
  • 383
74
votes
5 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
  • 28,163
  • 29
  • 106
  • 188
60
votes
4 answers

Can't use System.Configuration.Configuration manager in a .NET Standard2.0 library on .NET FX4.6

I have an assembly created in NetStandard2.0. It reads AppSettings using System.Configuration.ConfigurationManager. I have installed nuget package of System.Configuration.ConfigurationManager with version 4.4.X which is suitable for…
kiran
  • 1,242
  • 1
  • 10
  • 25
59
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
  • 11,278
  • 15
  • 74
  • 148
1
2 3
99 100