2

I am having a weird issue to get a reference added to the project's references. Let me first just show the setup I have.

I have two packages: Framework.nuspec and Resources.nuspec. Each containing a dll. The dll in the Framework.nuspec is 88KB and the dll in the Resources.nuspec is 13605 KB.

Framework.nuspec is as follows:

<? xml version="1.0"?> <package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd"> <metadata> <id>Framework</id> <version>1.0.2</version> <title>Framework</title> <authors>Author</authors> <owners>Owner</owners> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>Core functionality</description> <copyright>Copyright © 2016 Company</copyright> </metadata> <files> <file src="bin\Framework.dll" target="lib\net461" /> </files> </package> 

Resources.nuspec is as follows:

<?xml version="1.0"?> <package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd"> <metadata> <id>Resources</id> <version>1.0.2</version> <title>Resources</title> <authors>Author</authors> <owners>Owner</owners> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>All resources</description> <copyright>Copyright © 2016 Company</copyright> </metadata> <files> <file src="bin\Resources.dll" target="lib\net461" /> </files> </package> 

As you can see, the setup for the packages are simple and looks exactly the same, except for the names and files. Then the command to pack these packages is a simple: nuget.exe pack Framework.nuspec and nuget.exe pack Resources.nuspec

Now what happens is, when I add the Framework package, it adds the reference correctly: Framework

But when I add the Resources packages, it doesn't add the reference at all: Resources

Is it something I am doing wrong? Is this a bug that I need to go and report or one that is already reported that I missed? Has someone encountered this before? Is it because I'm using net461?

I have created the packages over and over but no success.

Any feed back will be much appreciated.

Kind Regards, Willem Toerien

UPDATE: Here are the outputs for the adding of the Resources package:

Attempting to gather dependencies information for package 'Resources.1.0.2' with respect to project 'ConsoleApplication1', targeting '.NETFramework,Version=v4.6.1' Attempting to resolve dependencies for package 'Resources.1.0.2' with DependencyBehavior 'Lowest' Resolving actions to install package 'Resources.1.0.2' Resolved actions to install package 'Resources.1.0.2' Adding package 'Resources.1.0.2' to folder 'C:\Users\wtoerien\Documents\Visual Studio 2015\Projects\ConsoleApplication1\packages' Added package 'Resources.1.0.2' to folder 'C:\Users\wtoerien\Documents\Visual Studio 2015\Projects\ConsoleApplication1\packages' Added package 'Resources.1.0.2' to 'packages.config' Successfully installed 'Resources 1.0.2' to ConsoleApplication1 ========== Finished ========== 

As you can see, there are no warnings.

4
  • The first thing I'd check: did you have any warnings when you executed nuget pack for Resources? And did you check the content of the nupkg? Commented Mar 9, 2016 at 8:38
  • Hi Anton, thank you for commenting. In the output there is no warnings. I'll update the question with the output. Commented Mar 9, 2016 at 8:39
  • And what about the content of package? Do you have the dll in place? Commented Mar 9, 2016 at 8:40
  • Yes, I have the dll in place. It's there. I have even tried adding the <references> tag, but to no avail, same result, same output. Commented Mar 9, 2016 at 8:44

1 Answer 1

3

Okay, after some playing around, I have found something very odd. As soon as I add "X" to all resources, the dll gets added! Resources.nuspec to ResourcesX.nuspec, Resources.dll to ResourcesX.dll as well as the title inside the nuspec file.

That said, my full notation is Company.Framework.Plugin.Resources.dll so essentially when I changed everything to Company.Framework.Plug.ResourcesX.dll it worked.

Here is the nuspec:

<?xml version="1.0"?> <package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd"> <metadata> <id>Company.Framework.Plugin.ResourcesX</id> <version>1.0.2</version> <title>Company Web Resources Plugin</title> <authors>Company</authors> <owners>Company</owners> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>Core images and entity name definitions for Framework web applications.</description> <copyright>Copyright © 2016 Company, Inc.</copyright> </metadata> <files> <file src="bin\*.*" target="lib\net461" /> </files> </package> 

Here is the result:

Resources

Output is as follows:

Attempting to gather dependencies information for package 'Company.Framework.Plugin.ResourcesX.1.0.2' with respect to project 'ConsoleApplication1', targeting '.NETFramework,Version=v4.6.1' Attempting to resolve dependencies for package 'Company.Framework.Plugin.ResourcesX.1.0.2' with DependencyBehavior 'Lowest' Resolving actions to install package 'Company.Framework.Plugin.ResourcesX.1.0.2' Resolved actions to install package 'Company.Framework.Plugin.ResourcesX.1.0.2' Adding package 'Company.Framework.Plugin.ResourcesX.1.0.2' to folder 'C:\Users\wtoerien\Documents\Visual Studio 2015\Projects\ConsoleApplication1\packages' Added package 'Company.Framework.Plugin.ResourcesX.1.0.2' to folder 'C:\Users\wtoerien\Documents\Visual Studio 2015\Projects\ConsoleApplication1\packages' Added package 'Company.Framework.Plugin.ResourcesX.1.0.2' to 'packages.config' Successfully installed 'Company.Framework.Plugin.ResourcesX 1.0.2' to ConsoleApplication1 ========== Finished ========== 

So it seems to me that there is something regarding the Resources name that is preventing it from being added. I will log a bug to nuget, but I guess in the meantime we will just have to work around it.

Thanks.

Sign up to request clarification or add additional context in comments.

2 Comments

NuGet treats assemblies that end with .Resources.dll as language resource assemblies and will not reference them. There is a document on creating localized packages. Also see this stackoverflow question - stackoverflow.com/questions/35705750/…
Thank you for your response! I didn't know that.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.