Package restore failed ASP.NET 5

1.4k views Asked by At

I am experiencing an issue with package restoring from NuGet repository in Visual Studio 2015.

When I am creating a new ASP.NET 5 project the dependencies related to ASP.NET 5 don't seem to be downloaded and added to my new project and I get that exclamation mark in yellow triangle sign next to each reference, instead.Solution Explorer.png Well, obviously, I can't build a solution as the dependencies are highlighted red in project.jason. When I hit Restore Packages option in my Solution Explorer the packages don't get restored and I get that Package restore failed message. In the output I can see that it fails due to an exception at System.Security.Cryptography.SHA256Managed..ctor()

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms. at System.Security.Cryptography.SHA256Managed..ctor() --- End of inner exception stack trace ---

Output window.png

I am using latest DNX (1.0.0-rc1-update1 clr x64), in fact I've tried to use different DNXs none of them worked as it supposed to. Also I've tried to reinstall ASP.NET 5 bundle; to repair Visual Studio 2015; uninstalled and installed NuGet package manager in different ways; tried to delete NuGet.Config from AppData\Roaming\NuGet, manually deleted files from AppData\Local\Microsoft\VisualStudio; restored default settings, but none of the above solutions worked for me. The only "sort of fix" which did something for me was cmd prompt "dnu restore" command in project folder. It resolved my initial dependecies "Microsoft.AspNet.IISPlatformHandler" and "Microsoft.AspNet.Server.Kestrel" and I managed to build the project. I thought it would be it, but, in truth, it didn't do much: I am stil not able to add any new dependency, even if I type it in manually in project.jason the NuGet package manager fails when trying to resolve it.


The question is: has anyone experienced similar issues? How can I force NuGet manager to resolve ASP.NET 5 dependencies? Any advice is appriciated. Links to the articles, threads, comments are welcomed.

1

There are 1 answers

3
janpieter_z On BEST ANSWER

Your development machine has the FIPS algorithm policy enabled and therefore labels this implementation of SHA256 as invalid. .NET does offer a FIPS compliant implementation: SHA256CryptoServiceProvider.

If you have no idea why your machine is set to be FIPS compliant, your administrator might be able to help you out. Since this can be a requirement or even regulation in your industry, I'd try to make sure. There are ways to disable the FIPS mode in case you're sure that you don't have to be compliant.