Dependency Resolution Attempt: Modifying the .NET Standard Library for NET Core - Microsoft.Extensions.Primitives

I am running a Visual Studio 2015 3 update. I am trying to use Redis Cache for .Net applications. Since the developed package is focused on the standard .Net library. I downloaded the code from github and tried to change my properties myself.

Here are the projects:

enter image description here

First, I try to use the abstraction class library for the target .Net kernel, then I tried to add Microsoft.Extensions.Primitives, since version 1 does not support .NET Core. I added the final package:

Install-Package Microsoft.Extensions.Primitives -Version 1.0.0-rc1-final -Pre 

He cannot decide, saying that

The Microsoft.Extensions.Primitives> = 1.0.0-rc1-final dependency could not be resolved.

How can I fix this so that it works for .NET Core? How is .NET Core 1 different from .NET Core 5, so how is it dependent on the installed package?

enter image description here

Why do all packages support .NET Standard Libary and not .NET Core?

0
source share
1 answer

I don’t know what exactly you are doing, but the rc1 links seem to be wrong now that ASP.NET Core RTM has been shutting down for several months.

I grabbed 1.0.0 sourced (you need to specifically select the 1.0.0 tag. The main branch is based on ASP.NET Core 1.1).

The only thing I changed was project.json (I unloaded other unloaded unrelated projects and test projects, except for Microsoft.Extensions.Caching.Redis.Test .

This is my project.json (from Microsoft.Extensions.Caching.Redis ):

 { "version": "1.0.0", "description": "Distributed cache implementation of Microsoft.Extensions.Caching.Distributed.IDistributedCache using Redis.", "packOptions": { "repository": { "type": "git", "url": "https://github.com/aspnet/caching" }, "tags": [ "cache", "distributedcache", "redis" ] }, "buildOptions": { "warningsAsErrors": true, "keyFile": "../../tools/Key.snk", "nowarn": [ "CS1591" ], "xmlDoc": true }, "dependencies": { "Microsoft.Extensions.Caching.Abstractions": "1.0.0", "Microsoft.Extensions.Options": "1.0.0", "StackExchange.Redis.StrongName": "1.1.608" }, "frameworks": { "netstandard1.5": { }, "net451": { "dependencies": { }, "frameworkAssemblies": { "System.Runtime": { "type": "build" } } } } } 

No changes are required in Microsoft.Extensions.Caching.Abstractions .

Alternatively, you can use StackExchange.Redis instead of StackExchange.Redis.StrongName , which is not a strong name (signed). Not sure if the created / compiled package will be signed with the same key as the other packages, which may cause problems later. If you use unsigned, then it can also cause problems if your strong application has named itself (or you have a business requirement that all assemblies be a strong signature).

This compiler and unit tests pass, have not tested further.

As for the rest of your question:

".NET Core 5" nuget target dnx50 , which was used before ASP.NET Core rc1. With rc2, ASP.NET Core switched to dotnet-cli, and DNX is no longer supported and will not receive any additional updates. Netstandard was introduced with netstandard to simplify the creation of class libraries that can target most of the available platforms (full .NET Framework, .NET Core, WinRT / WindowsPhone / Windows8 / Windows10, mono, Xamarin, etc.). You can learn more about the .NET Standard Library .

+1
source

Source: https://habr.com/ru/post/1011929/


All Articles