Search code examples
nugetvisual-studio-2015project-reference

Nuget not adding reference for assemblies whose name ends in .Resources


When using the NuGet package manager to install a package containing an assembly whose name ends in .Resources, the package installs correctly but a reference to that assembly is not added to the project.

Tools: -

  • Visual Studio Enterprise 2015 v4.6.00081
  • NuGet Package Manager for Visual Studio 2015 v3.2.60914.10516

.nuspec file:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>ClassLibrary.TestPackage</id>
    <version>1.0.0.0</version>
    <title>ClassLibrary.TestPackage</title>
    <authors>Me</authors>
    <owners>Me</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>$description$</description>
    <tags></tags>
  </metadata>
</package>

.nupkg contents: -

  • lib
    • net46 (.NETFramework,Version=4.6)
    • ClassLibrary.Resource.dll
    • ClassLibrary.Resources.dll
    • ClassLibrary.Resourcex.dll
    • ClassLibrary.ResourcesWhatever.dll
    • ClassLibrary.Whatever.dll
    • ClassLibrary.WhateverResources.dll

All 6 of the assemblies are empty class libraries targetting .Net 4.6.

When installing the nuget package, references are added for all assemblies except: -

  • ClassLibrary.Resources.dll

It would seem specifically that assemblies whose name ends in .Resources are causing the problem.

The problem continues further when upgrading such an assembly - the reference remains pointing to the previous version and indeed the package itself remains in the packages folder.

A workaround, of course, is to simply add a reference manually but this is proving to be repetitive and tiresome for a regularly changing library used in mutliple projects.


Solution

  • It appears to be by design: -

    https://github.com/NuGet/Home/issues/1499