"Unable to find framework assemblies", am I using this wrong?

Apr 1, 2011 at 1:51 PM
Edited Apr 1, 2011 at 1:58 PM

I'm trying to use the new frameworkAssemblies tag. I have a library that has a NET40 version and only the SSL40 version needs a reference to a GAC assembly. So I set the targetFramework="SL40" but when I install the nuget for a NET40 project i get the following error:

Install-Package : Unable to find framework assemblies that are compatible with the target framework '.NETFramework,Version=v4.0'.
At line:1 char:16
+ Install-Package <<<<  impromptuInterface
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

Isn't this what the targetFramework attribute is for? The .net version doesn't need any assembly references.

Apr 1, 2011 at 3:28 PM

Can you send your package or nuspec.

Aug 3, 2011 at 12:02 PM

Any news on this topic? I encounter the same problem.

Aug 3, 2011 at 4:35 PM

We never received the additional information from the original poster, so no :)

If you share more details about what you're doing, we can help figure it out.

Aug 3, 2011 at 7:13 PM


Let me try to explain what I want to achieve and what goes wrong:

I'm trying to create a nuget package for a software library 'mylib.dll' that exist in a Silverlight and a .Net variant. The Silverlight variant has a dependency on an assembly 'some.required.lib.dll' in the Silverlight. The .Net variant of the library does not have a corresponding dependency. This assembly is not available through a nuget package.

So, I created a directory structure where I put the Silverlight variant of 'mylib.dll' in the directory 'lib\sl4' and the .Net variant in 'lib\net40'.

Next, I created 'mylib.nuspec' and defined the dependency on 'some.required.lib.dll' as follows:

      <frameworkAssembly assemblyName="some.required.lib" targetFramework="sl4" />

Now, when I try to install the nuget package created from this spec file, it complains that 'some.required.lib.dll' is not available for the 'net40' platform.

So, it looks like nuget tries to resolve the depenency on 'some.required.lib.dll'on the .net platform even though I've indicated explicitely that the dependency is only required for sl4.

Am I doing something wrong? Is this a bug? Or is what I want currently not possible?

Any help would be appreciated.


Aug 3, 2011 at 7:18 PM

Strange, I would have thought that this would work. One point to clarify: is some.required.lib.dll a Sliverlight framework that's in your GAC? Or your own assembly that you want to include in the package?

Aug 3, 2011 at 7:23 PM

Eh, mine actually had a corresponding .net framework so i just removed the the targetFramework="sl4" and had moved on by 10:30am since there was no harm in adding the extra assembly reference and probably made more sense in general.

Aug 3, 2011 at 7:24 PM

Thanks for your reply.

It's an assembly that's in my GAC. So I don't want to include it in the package.

Aug 3, 2011 at 7:26 PM

techekon: thanks for sharing. In my case this is not an option because the assembly is not present in the .Net framework.

Aug 3, 2011 at 7:30 PM

Hmmm, I did a quick test and as far as I can see, this feature is broken. :(  I'll open a bug.

Aug 3, 2011 at 7:32 PM

Thanks for trying. I will create separate packages for the two platforms until the feature is working again.

Aug 3, 2011 at 7:39 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Aug 3, 2011 at 8:31 PM

Turns out there is an easy (albeit quirky) workaround: add a 'dummy' entry to the list that targets net40. e.g.

      <frameworkAssembly assemblyName="TheSilverlightLib" targetFramework="sl40" />
      <frameworkAssembly assemblyName="System" targetFramework="net40" />

This is basically a no-op since every project references "System" already, but it works around the bug. Let me know how that works for you.

Aug 4, 2011 at 7:19 AM

Yes, that works! Thanks. I'll use that trick.

Aug 4, 2011 at 7:39 AM

We're going to relax the constraint in the next version of nuget.