Unable to load nuget package that contains a constraint on a pre-release package.

Using Linqpad 5.26.01 Premium.

Attempting to load nuget package "ICSharpCode.Decompiler" which has a dependency on a pre-release version of Mono.Cecil (0.10.0-beta7).
I checked the 'Include Prerelease' option, and added Mono.Cecil directly but when pulling ICSharpCode.Decompiler, I get the following error:
Error downloading 'ICSharpCode.Decompiler' - Unable to find a version of 'Mono.Cecil' that is compatible with 'ICSharpCode.Decompiler constraint: Mono.Cecil (>= 0.10.0-beta7)'.

Please explain how to add a nuget package with a constraint on a pre-release package.



  • I get the same error when trying to install that package with the NuGet.exe command-line, and also through the Visual Studio NuGet Package Manager. Have you tried the same?
  • Joe, I appreciate the quick response.
    I tested from VS 15.5.2 - initially I get the same message but if I add the Cecil beta7 package first, then add the Decompiler, I am able to load the decompiler. I tried again from Linqpad with sames steps - add beta Cecil first, then Decompiler and linqpad fails to find the local copy of Cecil beta when it looks for the dependencies. I'm happy to share a linqpad log if you tell me where it is stored.
  • This sounds like a bug in VS. The NuGet package manager shouldn't allow that.

    I could *try* to introduce a similar bug into LINQPad, but it requires a change that risks breaking other packages that have valid dependencies.
  • I would rather not introduce functionality to handle a bug. If I understand correctly, NuGet should not allow a published package to depend on a pre-release package?
  • Given that both the NuGet command-line & VS throw by default in this scenario, it's reasonable to assume that you're not supposed to create stable packages with pre-release dependencies.
Sign In or Register to comment.