NuGet Fails to Install FluentValidation

有些话、适合烂在心里 提交于 2019-12-11 19:27:08

问题


I am attempting to install the NuGet package Nancy.Validation.FluentValidation but the installation fails due to, I think, unsupported frameworks?

The full NuGet error is below. I am using .NET 4.5. I cant see why it would fail? Any ideas what is going wrong?

Output when installing Nancy.Validation.FluentValidation:

Attempting to resolve dependency 'Nancy (≥ 1.2.0)'.
Attempting to resolve dependency 'FluentValidation'.
Installing 'FluentValidation 5.6.2.0'.
Successfully installed 'FluentValidation 5.6.2.0'.
Installing 'Nancy.Validation.FluentValidation 1.2.0'.
Successfully installed 'Nancy.Validation.FluentValidation 1.2.0'.
Adding 'FluentValidation 5.6.2.0' to Server.
Uninstalling 'FluentValidation 5.6.2.0'.
Successfully uninstalled 'FluentValidation 5.6.2.0'.
Install failed. Rolling back...
Specified argument was out of the range of valid values.
Parameter name: supportedFrameworks

Output when installing FluentValidation:

Installing 'FluentValidation 5.6.2.0'.
Successfully installed 'FluentValidation 5.6.2.0'.
Adding 'FluentValidation 5.6.2.0' to Server.
Uninstalling 'FluentValidation 5.6.2.0'.
Successfully uninstalled 'FluentValidation 5.6.2.0'.
Install failed. Rolling back...
Specified argument was out of the range of valid values.
Parameter name: supportedFrameworks

回答1:


That error can happen if the Portable Class Library (PCL) profiles are messed up. If there is a PCL profile on your machine that does not have any profile xml files in it then NuGet will throw that error. Tracking what PCL profile is broken is the difficult part.

One way to track the problem down is to use this command line app, compile it and put a breakpoint on the line where the ArgumentOutOfRangeException is being thrown. That should give you the PCL profile name. Then look in its SupportedFramework directory to see what .xml files are in there. It may contain no .xml files or it may just contain Xamarin .xml files. The Xamarin .xml files are treated as optional so this exception can still occur if they are the only profile .xml files in that directory.




回答2:


I was able to fix the same error (but different package) by installing the .NET Portable Library targeting pack component in the Visual Studio Installer. This can be found on the Individual components tab in the .NET category.



来源:https://stackoverflow.com/questions/31467317/nuget-fails-to-install-fluentvalidation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!