HttpContext in .net standard library

There’s a problem to your approach: .NET Standard is the most bare-bones implementation of .NET available, meaning that only basic features which are platform- and scenario-agnostic are implemented. HttpContext exists on both the .NET Framework and .NET Core (both of which implement .NET Standard, by the way), but being specific to the Web, it does … Read more

.NET Standard vs .NET Core

I will try to further clarify your doubts and extend Jon Skeet answer. .NET Standard is a specification, so a library compiled for a specific .NET Standard version can be used in different .NET Standard implementations. As said in my other comment, a good analogy for the relationship between .NET Standard and other .NET Standard … Read more

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

In many cases, this can be solved by adding the following code to the csproj file of your test project: <PropertyGroup> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType> </PropertyGroup> This forces the build process to create a .dll.config file in the output directory with the needed binding redirects. The reason is that “classic” csproj test projects are true “libraries” and … Read more

Convert .NET Standard class library to native aar/jar

Update: The name changed to “.NET Embedding” and it is at v0.4 at the time of this update. https://developer.xamarin.com/releases/dotnetembedding/dotnetembedding_0/dotnetembedding_0.4/ New instructions: Installing .NET Embedding Original post: You can use Mono’s Embeddinator-4000 It supports various language consumers, so it surfaces .NET code as idiomatic code in the target language. This is the list of supported languages … Read more

Disable transitive project reference in .NET Standard 2

Transitive project references (ProjectReference) Transitive project references are new feature of SDK-style csproj (1,2) format used in .NET Core/.NET >= 5. You can also use this csproj for old .NET Framework projects (1,2,3) but with some exceptions. In this SDK-style format project references (represented by <ProjectReference> entry in .csproj file) are transitive. This is different … Read more

Auto Versioning in Visual Studio 2017 (.NET Core)

Add <Deterministic>False</Deterministic> inside a <PropertyGroup> section  of .csproj The workaround to make AssemblyVersion * working is described in “Confusing error message for wildcard in [AssemblyVersion] on .Net Core #22660” Wildcards are only allowed if the build is not deterministic, which is the default for .Net Core projects. Adding <Deterministic>False</Deterministic> to csproj fixes the issue. The reasons why .Net Core … Read more

Compatibility shim used by .NET Standard 2.0

This works by creating all the necessary libraries that are referenced by classic .NET libraries. E.g. in .NET Core the implementation of Object or Attribute is defined in System.Runtime. When you compile code, the generated code always references the assembly and the type => [System.Runtime]System.Object. Classic .NET projects however reference System.Object from mscorlib. When trying … Read more

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

Definition We have 3 interfaces: ILogger, ILoggerProvider and ILoggerFactory. Let’s look at the source code to find out their responsibilities: ILogger: is responsible to write a log message of a given Log Level. ILoggerProvider: is responsible to create an instance of ILogger (you are not supposed to use ILoggerProvider directly to create a logger) ILoggerFactory: … Read more