nuget 没有添加引用 [英] nuget is not adding references

查看:101
本文介绍了nuget 没有添加引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将引用添加到项目引用时遇到了一个奇怪的问题.让我先展示一下我的设置.

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.

我有两个包:Framework.nuspec 和 Resources.nuspec.每个包含一个dll.Framework.nuspec中的dll为88KB,Resources.nuspec中的dll为13605KB.

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 如下:

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 如下:

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>

如您所见,除了名称和文件外,软件包的设置很简单,看起来完全相同.那么打包这些包的命令很简单:nuget.exe pack Framework.nuspecnuget.exe pack Resources.nuspec

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

现在发生的情况是,当我添加 Framework 包时,它正确添加了引用:

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

但是当我添加 Resources 包时,它根本不添加引用:

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

是不是我做错了什么?这是一个我需要去报告的错误还是一个我错过的已经报告的错误?以前有人遇到过这个吗?是不是因为我用的是net461?

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.

任何反馈将不胜感激.

亲切的问候,威廉·托里恩

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 ==========

如您所见,没有警告.

推荐答案

好吧,玩了一会之后,我发现了一些很奇怪的东西.一旦我向所有资源添加X",dll 就会被添加!Resources.nuspecResourcesX.nuspecResources.dllResourcesX.dll 以及里面的标题nuspec 文件.

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.

也就是说,我的完整符号是 Company.Framework.Plugin.Resources.dll 所以基本上当我将所有内容更改为 Company.Framework.Plug.ResourcesX.dll 时工作.

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.

这里是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>

结果如下:

输出如下:

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 ==========

所以在我看来,关于 Resources 名称的某些东西阻止了它被添加.我会将一个错误记录到 nuget,但我想在此期间我们只需要解决它.

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.

谢谢.

这篇关于nuget 没有添加引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆