No usable .NET assemblies in NuGet package
I'm having intermittent issues including some NuGet packages into LINQPad.
Like some, we run an internal instance of the NuGet gallery and host our own packages. I've been successful in connecting to our gallery, viewing the packages and even including some, but others give me the following error: "There are no usable .NET assemblies in package ''."
After looking into the few packages that fail, I seem to notice a trend. All the packages that fail were compiled using the .NET 4.5.1 framework whereas the ones that work were compiled using 4.5.
I found the thread with the few others that were getting this error with other packages and verified that my packages contain the lib folder with the appropriate net451 underneath it that contains the assembled .dll.
Best guess so far is LINQPad is not looking for the net451 folder or cannot include assemblies that were compiled using 4.5.1.
To further test, I'm going to compile the same assemblies under 4.5 and include them in the packages as well and see if that works.
Like some, we run an internal instance of the NuGet gallery and host our own packages. I've been successful in connecting to our gallery, viewing the packages and even including some, but others give me the following error: "There are no usable .NET assemblies in package ''."
After looking into the few packages that fail, I seem to notice a trend. All the packages that fail were compiled using the .NET 4.5.1 framework whereas the ones that work were compiled using 4.5.
I found the thread with the few others that were getting this error with other packages and verified that my packages contain the lib folder with the appropriate net451 underneath it that contains the assembled .dll.
Best guess so far is LINQPad is not looking for the net451 folder or cannot include assemblies that were compiled using 4.5.1.
To further test, I'm going to compile the same assemblies under 4.5 and include them in the packages as well and see if that works.
Comments
www.linqpad.net/beta.aspx
I'm using the latest LINQPad beta v4.52.04, but I've also tried 4.51.03 with no luck there either.
The affected RavenDB Client v3.0 nuget packages only have a lib\net45 directory for their assemblies.
Previous RavenDB Client nuget packages (e.g. v2.5) always worked for me in LINQPad. The only differences that I can see are that the prior versions had lib\net40, lib\net45, and lib\sl50 directories, and that its nuspec file has a node which v3.0 is missing.
tested on LiqPad v4.52.04 (beta) & v4.51.03
I tried EnterpriseLibrary.Logging just now too and had the same problem.
.NET 4.5 has the version 4.0.30319.17929
.NET 4.5.1 has the version 4.0.30319.18444
LINQPad thinks you're running Framework 4.0 and so it will not use the 4.5 NuGet references.
This is peculiar because I thought that Windows 8.1 came pre-installed with Framework 4.5.
I compiled a console app in VS2013 just now, targeting the .NET 4.5 framework and it also reported version 4.0.30319.0. Tried targeting 4.5.1, and that too reported version 4.0.30319.0.
I then tried downloading and running the installer for the .NET 4.5 framework, but it refused to install saying that 4.5 is already part of the operating system, and that the same or higher version has already been installed. Note, I'm currently using my Windows 10 Preview PC at the moment, but in about an hour I'll be sitting at my Windows 8.1 one and can check that.
Edit:
My Windows 8.1 machine is showing the exact same behaviour.
public static bool IsNet45OrNewer() { // Class "ReflectionContext" exists from .NET 4.5 onwards. return Type.GetType("System.Reflection.ReflectionContext", false) != null; }
Such code is returning true for me in the same LINQPad script that returns 4.0.30319.0 for Environment.Version.
After reading http://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx, I've looked at the relevant keys in the registry of this PC (Win 8.1 x64).
HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client\Release = 381029 (.NET Framework 4.6 Preview)
HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client\Version = 4.5.53349
HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client\1033\Release = 381029 (.NET Framework 4.6 Preview)
HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client\1033\Version = 4.5.53349
HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client\2052\Release = 378675 (.NET Framework 4.5.1 installed with Windows 8.1)
HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client\2052\Version = 4.5.51641
HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\Release = 381029 (.NET Framework 4.6 Preview)
HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\Version = 4.5.53349
HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\1033\Release = 381029 (.NET Framework 4.6 Preview)
HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\1033\Version = 4.5.53349
HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\2052\Release = 378675 (.NET Framework 4.5.1 installed with Windows 8.1)
HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\2052\Version = 4.5.51641
HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0\Client\Version = 4.0.0.0
Note, I've also apparently got the 4.6 Preview installed, I believe it was included when I installed the VS2015 Preview recently (on both machines).
Environment.Version
reports4.0.30319.0
I've got Visual Studio 15 RC installed.