NuGet Fails to Install FluentValidation

2019-08-21 17:23发布

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

2条回答
Summer. ? 凉城
2楼-- · 2019-08-21 17:26

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.

查看更多
叛逆
3楼-- · 2019-08-21 17:31

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.

查看更多
登录 后发表回答