New Feature: Adding Framework References

Developer
Feb 18, 2011 at 11:58 AM

Hi all,

I've just added the ability to add a framework reference (gac reference) by adding section to the nuspec:

http://nuget.codeplex.com/workitem/298

There is a new section in the metadata section of the nuspec called "frameworkAssemblies":

<?xml version="1.0"?>
<package>
  <metadata>
    <id>PackageWithGacReferences</id>
    <version>1.0</version>
    <authors>Author here</authors>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>A package that has framework assemblyReferences depending on the target framework.</description>
    <frameworkAssemblies>
      <frameworkAssembly assemblyName="System.Web" targetFramework="net40" />
      <frameworkAssembly assemblyName="System.Net" targetFramework="net40-client, net40" />
      <frameworkAssembly assemblyName="Microsoft.Devices.Sensors" targetFramework="sl4-wp" />
      <frameworkAssembly assemblyName="System.Json" targetFramework="sl3" />
      <frameworkAssembly assemblyName="System.Windows.Controls.DomainServices" targetFramework="sl4" />
    </frameworkAssemblies>
  </metadata>
</package>

It's analogous to the lib folder in that you can specify what framework assemblies you what referenced for each target framework. When uninstalling we'll never remove a framework reference.

Given the above package as an example, here is what will get installed for specific project targets:

Project targeting .NET4 -> System.Web, System.Net
Project targeting .NET4 Client Profile -> System.Net
Project targeting Silverlight 3 -> System.Json
Project targeting Silverlight 4 -> System.Windows.Controls.DomainServices
Project targeting WindowsPhone ->  Microsoft.Devices.Sensors

If you have any feedback on the feature or any suggestions on how it can be improved, feel free to provide any feedback.

Coordinator
Feb 18, 2011 at 5:12 PM

Nice! I’ve created a .nuspec 1.2 page and updated it with this information: http://nuget.codeplex.com/wikipage?title=.nuspec%20v1.2%20Format

Once we go live with 1.2, I’ll switch the existing one with this new one.

Phil

Feb 18, 2011 at 6:13 PM

Gave this a quick try, and seems to work. One issue: when the assembly doesn't exists, it fails with the error "Error HRESULT E_FAIL has been returned from a call to a COM component." Not helpful! :)

Feb 18, 2011 at 6:14 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Feb 25, 2011 at 8:08 AM

Btw, do we want to show this information in the dialog?

 

Coordinator
Feb 25, 2011 at 5:06 PM

Yes, we probably do. Can you log a bug on that and maybe mock something up for how it will look?

Feb 25, 2011 at 6:19 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jun 7, 2011 at 9:08 AM
Edited Jun 7, 2011 at 9:09 AM

Hello,

This issue have been fixed for framework assemblies.

Currently i'm using NuGet with Gac references (installed from our installer, this is not a framework assembly). This works fine but we're getting the same error message "Error HRESULT E_FAIL has been returned from a call to a COM component." (only when the reference is missing)

Could it be fixed ?

It could be interesting to specify in the error message the name of the assembly missing that is specified in the nuspec file

Thanks,

Mat

Developer
Jun 7, 2011 at 9:34 AM

Can you send your package.

Jun 7, 2011 at 10:20 AM

Here is the package

http://cid-9c34f56a7c4348df.office.live.com/self.aspx/Public/GAthena.1.5.8.nupkg

As i mentionned, this is not really an issue, just the error message which is not really explicit when the user does not have the assembly in GAC

Thanks