3

I have an ASP .Net project that targets .net 4.7.1. I'm trying to add the Microsoft.AspNetCore.DataProtection package (that depends on .net standard 2.0).

I thought .net 4.7.1 is part of the .net standard 2.0, but NuGet tells me the following when I try to add this package.

Attempting to gather dependency information for package 'Microsoft.AspNetCore.DataProtection.2.0.2' with respect to project 'IssueCenter.Website', targeting '.NETFramework,Version=v4.7.1'
Gathering dependency information took 239,47 ms
Attempting to resolve dependencies for package 'Microsoft.AspNetCore.DataProtection.2.0.2' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Microsoft.AspNetCore.DataProtection.2.0.2'
Resolved actions to install package 'Microsoft.AspNetCore.DataProtection.2.0.2'
Retrieving package 'Microsoft.AspNetCore.DataProtection 2.0.2' from 'NuGet official package source'.
  GET https://www.nuget.org/api/v2/package/Microsoft.AspNetCore.DataProtection/2.0.2
  OK https://www.nuget.org/api/v2/package/Microsoft.AspNetCore.DataProtection/2.0.2 291ms
Installing Microsoft.AspNetCore.DataProtection 2.0.2.
Install failed. Rolling back...
Package 'Microsoft.AspNetCore.DataProtection.2.0.2' does not exist in project 'IssueCenter.Website'
Package 'Microsoft.AspNetCore.DataProtection.2.0.2' does not exist in folder 'D:\projetos\IssueCenter\DotNet\IssueCenter2.DotNet\packages'
Executing nuget actions took 984,59 ms
Could not install package 'Microsoft.AspNetCore.DataProtection 2.0.2'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.7.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Time Elapsed: 00:00:01.4162507
========== Finished ==========

It happens on Visual Studio 2012 and Visual Studio 2017.

Microsoft Visual Studio Community 2017  15.0.26228.4 D15RTWSVC

Microsoft .NET Framework                4.7.02556

NuGet Package Manager                   4.0.0

How can I add the Microsoft.AspNetCore.DataProtection package into a .net 4.7.1 project?

6
  • I had no trouble adding it to a winforms app. Copy/paste the package manager trace into your question and mention your VS version. Commented Mar 16, 2018 at 17:13
  • done @HansPassant Commented Mar 16, 2018 at 17:19
  • Visual Studio 2012 can't work with .NET Standard. Commented Mar 16, 2018 at 17:21
  • @PanagiotisKanavos You're right, I installed vs 2017 for this purpose and unfortunately the same error occours (the pasted output was taken from vs 2017) Commented Mar 16, 2018 at 17:23
  • Which version of VS 2017 are you using? check that your vs 2017 installation is up-to date Commented Mar 16, 2018 at 18:09

1 Answer 1

3

NetStandard 2.0 support was added in VS 15.3, your 15.0 RTW version will not be able to install .NET Standard 2.0 packages.

You may experience issues in (classic) ASP.NET applications when using .NET Standard assemblies. Check the dotnet/Announcements GitHub issue on this topic, specifically:

Web applications and web sites don't support automatic binding redirect generation. In order to resolve binding conflicts, you need to double click the warning in the error list and Visual Studio will add them to your web.config file.

Sign up to request clarification or add additional context in comments.

1 Comment

Worked after updating to v15.6.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.