NuGet包没有添加引用

问题描述:

我有一个定制的NuGet包(My.Resources)包含程序集和对另一个定制NuGet包(My.Base)的依赖关系。NuGet包没有添加引用

如果我安装软件包,安装会成功完成,但不会添加程序集引用。下面是从Install-Package命令输出全:

Attempting to resolve dependency 'My.Base (≥ 1.0.0)'. 
Installing 'My.Base 1.0.0'. 
Added file 'My.Base.dll' to folder 'My.Base.1.0.0\lib\net45'. 
Added file 'My.Base.1.0.0.nupkg' to folder 'My.Base.1.0.0'. 
Successfully installed 'My.Base 1.0.0'. 
Installing 'My.Rsources 1.1.0-beta0001'. 
Added file 'My.Resources.dll' to folder 'My.Resources.1.1.0-beta0001\lib\net45'. 
Added file 'My.Resources.XML' to folder 'My.Resources.1.1.0-beta0001\lib\net45'. 
Added file 'My.Resources.1.1.0-beta0001.nupkg' to folder 'My.Resources.1.1.0-beta0001'. 
Successfully installed 'My.Resources 1.1.0-beta0001'. 
Adding 'My.Base 1.0.0' to WindowsFormsApplication8. 
For adding package 'My.Base 1.0.0' to project 'WindowsFormsApplication8' that targets 'net45', 
>> Assembly references are being added from 'lib\net45' 
Added reference 'My.Base' to project 'WindowsFormsApplication8' 
Added file 'packages.config'. 
Added file 'packages.config' to project 'WindowsFormsApplication8' 
Successfully added 'My.Base 1.0.0' to WindowsFormsApplication8. 
Adding 'My.Resources 1.1.0-beta0001' to WindowsFormsApplication8. 
Added file 'packages.config'. 
Successfully added 'My.Resources 1.1.0-beta0001' to WindowsFormsApplication8. 

虽然我们有几个结构性其他自定义的NuGet软件包,并建立以同样的方式,这是唯一一个有这种行为。 .nupkg内部的.nuspec看起来不错,并且程序集位于正确的(net45)文件夹中。

NuGet将您的NuGet包视为仅包含语言资源的​​。这种NuGet包中的程序集未被引用。

如果您将My.Resources.dll重命名为类似My.Resources2.dll的内容,则NuGet将引用该程序集。

基本上任何以.resources.dll结尾的文件都被NuGet认为是资源组件,当NuGet软件包安装时不会被引用。