0

I have ASP.NET MVC 5 application with .NET 4.5.1. The application is having issue as described in this SO post.

So as per the suggestion i am trying to install https://github.com/Sustainsys/owin-cookie-saver nuget package However i am getting error

Severity Code Description Project File Line Suppression State Error Could not install package 'Kentor.OwinCookieSaver 1.1.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.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. 0

any idea?

LP13
  • 30,567
  • 53
  • 217
  • 400

1 Answers1

1

Right now, the ASP.NET MVC 5 app you have is targeting .NET 4.5.1. No surprise there. The error says "You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.1', but the package does not contain any assembly references or content files that are compatible with that framework."

The highlighted line indicates that the package you are trying to install is not built for .NET 4.5.1. I went ahead and downloaded the package itself (from NuGet.org). The package is currently targeting .NET 4.5.2. So if you change your target framework to .NET 4.5.2 and try to install, you will find it works out for you.

Ideally, packages available to the public would be built for a wider range of Target Frameworks but occasionally I do run into this. If you run into this again, go grab the package from the previous link (see the Manual Download on the right hand side of the page). Open up the .nupkg using 7-zip and open up the lib folder. There you will find what frameworks it is targeting and can adjust accordingly (or decide to try another package if you can't change).

techvice
  • 1,315
  • 1
  • 12
  • 24
  • The owin cookie saver uses the `HeadersWritten` flag, which is not available on 4.5.1. So I'm targeting the earliest possible framework version. – Anders Abel Jan 06 '18 at 20:16
  • @AndersAbel I'm not trying to call out the package for failing to provide libraries for all frameworks. I'm trying to point out that the library isn't available for the original posters targeted framework. If he wants to use the particular NuGet package, he should bump to .Net 4.5.2 or later. – techvice Jan 06 '18 at 20:21