热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如何在解决方案中管理每个项目的自己的nuget包-Howtomanageownnugetpackageperprojectinthesolution

Wewanttopackagesomethirdpartyassembliesintoourownnugetpackage.Icreatedsomepackagesw

We want to package some third party assemblies into our own nuget package. I created some packages with NuGet Package Explorer, and published it to our nuget server. I can also install it into our solution, however I have two problems:

我们想将一些第三方程序集打包到我们自己的nuget包中。我用NuGet Package Explorer创建了一些包,并将它发布到我们的nuget服务器。我也可以将它安装到我们的解决方案中,但是我有两个问题:

  1. Minor problem: when I install our nuget package a .nuget directory created with a packages.config in it. This contain a reference only to the package I added. We already have however several nuget packages installed into our solution. Every packages is in the packages subfolder in it's own subfolder, plus there's a repositories.config in the packages folder. The repositories config points to other packages.config, but not the one which is created by my actions into the .nuget folder. This is true even if I try to install the nuget package using the console into a specific project!
  2. 小问题:当我安装我们的nuget包时,在其中创建了一个包含packages.config的.nuget目录。这仅包含对我添加的包的引用。我们已经在我们的解决方案中安装了几个nuget包。每个包都在它自己的子文件夹的packages子文件夹中,另外在packages文件夹中有一个repositories.config。存储库配置指向其他packages.config,但不是由我对.nuget文件夹中的操作创建的。即使我尝试使用控制台将nuget包安装到特定项目中也是如此!
  3. Major problem: When I look up the installed packages in the "Manage NuGet packages for the Solution...", I only see an "Uninstall" button for my package. I expect and want to have a Manage button, same what we have for the other nuget packages, which allows to check/uncheck the package per project in a treeview.
  4. 主要问题:当我在“管理解决方案的NuGet包...”中查找已安装的软件包时,我只看到我的软件包的“卸载”按钮。我希望并希望有一个Manage按钮,与我们对其他nuget包的相同,它允许在树视图中检查/取消选中每个项目的包。

I use latest VS 2012, latest NuGet (2.2.xxx).

我使用最新的VS 2012,最新的NuGet(2.2.xxx)。

1 个解决方案

#1


1  

The problem was caused by incorrect package creation. When you create your package (with NuGet Package Explorer), on the right big "Package Contents" pane you want to create a lib folder by right click and selecting "Add Lib Folder" from the context menu. Then you want to add your assemblies into this folder instead of the root of the package content. Having the right package structure helped achieving the expected behavior: no .nuget folder is created any more and I can "Manage" my package also.

问题是由不正确的包创建引起的。当您创建包(使用NuGet包资源管理器)时,在右侧大的“包内容”窗格中,您要通过右键单击并从上下文菜单中选择“添加库文件夹”来创建一个lib文件夹。然后,您希望将程序集添加到此文件夹中,而不是包内容的根目录。拥有正确的包结构有助于实现预期的行为:不再创建.nuget文件夹,我也可以“管理”我的包。


推荐阅读
author-avatar
手机用户2602903375
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有