的NuGet不接受packages.config [英] NuGet does not honour packages.config

查看:210
本文介绍了的NuGet不接受packages.config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想生成一对内部C#项目中的NuGet包(最终多,但与这两个开始)在其他的解决方案/项目/等使用。这两个内部C#项目中有其他的NuGet包引用(企业库特别记录)。我使用的NuGet的功能,允许它建立在文件的csproj包来简化我的生活一点点。问题是,Nuget.Exe工具不能识别包,该项目引用作为依赖。为了给解决方案的完整布局:

I am trying to generate NuGet packages for a pair of internal C# projects (eventually more, but starting with these two) that are used in other solutions/projects/etc. Both of these internal C# projects have references to other NuGet packages (Enterprise Library Logging in particular). I am using the feature of Nuget that allows it to build the packages from the CSPROJ file to simplify my life a little bit. The problem is that the Nuget.Exe tool does not identify the packages that the project references as dependencies. To give a full layout of the solution:

Solution:
   Project 1
       Refs to some NuGet packages off the global repository (Enterprise Library, etc etc).
       (has a packages.config file that explicity lists them all)
   Project 2
       Refs to some NuGet packages off the global repository (Enterprise Library, etc. etc).
       Project ref to Project 1
       (has a packages.config file that explicity lists them all)

我使用的命令行是:

   nuget pack Project2.csproj -IncludeReferencedProjects -verbosity detailed

在命令行输出的培训相关部分是:

The relevent parts of the output of the command line are:

Found packages.config. Using packages listed as dependencies

Id: Project2
Version: 1.0.0.0
Authors: abc
Description: abc
Dependencies: Project1 (= 1.0.0.0)

Added file 'lib\net35\project2.dll'.



我本来期望依赖关系:PROJECT1,企业Libray记录,等等等等

I would have expected "Dependencies: Project1, Enterprise Libray Logging, etc etc etc"

*的注意的:我有一个nuspec文件添加到两个PROJECT1和Project2的获得依赖跨项目的部分工作正常。该nuspec文件基本上是空白,虽然,保存为占位符值:<?/ p>

*NOTE: that I had to add a nuspec file to both Project1 and Project2 to get the interproject dependency part working correctly. The nuspec file is essentially blank though, save for the placeholder values:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <title>$title$</title>
    <authors>abc</authors>
    <owners>abc</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>defr</description>
    <copyright>Copyright 2013</copyright>
  </metadata>
</package>



我在的NuGet问题跟踪发现的最接近的是的 http://nuget.codeplex.com/workitem/3097 ,但略有不同,并没有解决方案的提出似乎有工作

The closest thing I found on the NuGet issue tracker is http://nuget.codeplex.com/workitem/3097, but that is slightly different and neither of the solutions put forward in there seemed to work.

任何人有类似的情况正常工作?

Anybody have a similar situation working correctly?

我使用的NuGet 2.7与Visual Studio 2012

I am using NuGet 2.7 with Visual Studio 2012.

推荐答案

我结束了翻翻的NuGet源代码,并发现了什么,我们有问题了。

I ended up looking through the NuGet source code and found out what the problem we had was.

在我们的情况下,结束了两个不同的问题:

In our case, it ended up being two separate issues:


  • 的本身有文件的.sln项目中他们的文件夹

  • 我们错误地在我们构建脚本做包命令之前清空了解决方案级别包文件夹中。

为什么这些是导致问题的原因是因为的NuGet查找解决方案级封装文件夹来决定拉哪个软件包的依赖关系(不太清楚这个决定是怎么做)。如果要打包文件夹的路径不正确(仿佛的NuGet使用错误的解决方案文件时,它会),那么就无法正确解析的依赖关系。此外,如果产品的文件夹是空的,它也不能正确解析的依赖性。

The reason why these were causing problems is because NuGet looks for the solution level packages folder to decide which package dependencies to pull in (not quite sure how this determination is made). If the path to that packages folder is incorrect (as it would be if NuGet uses the wrong solution file), then it can't resolve the dependencies correctly. In addition if the packages folder is empty, it also cannot resolve the dependencies correctly.

这篇关于的NuGet不接受packages.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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