如何继承 NuGet 包中引用的程序集 [英] How to inherit referenced assemblies in NuGet package

查看:54
本文介绍了如何继承 NuGet 包中引用的程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单的问题.我有一个 NuGet 包项目.该项目引用了其他类库项目(它们不是 NuGet 包).我希望我的 NuGet 包将其引用 DLL 加载到安装该包的项目中.这是可能的,还是我所有引用的类库都需要是 NuGet 包才能将它们指定为依赖项?

Simple question. I have a NuGet package project. This project references other class library projects (they are not NuGet Packages). I would like my NuGet package to load its references DLL's into the project installing the package. Is this possible, or do all my referenced class libraries need to be NuGet packages in order to specify them as dependencies?

TIA

推荐答案

您可以将引用的 dll 作为文件添加到 nuspec,并且可以立即在 nuget 包中设置源路径文件和目标路径文件.接下来,您应该在 nuspec 中添加对此文件的引用.看起来像这样(我删除了其他元数据):

You can add your referenced dlls as files to nuspec and can set immediately source path file and target path file inside a nuget package. Next you should add references to this files in nuspec. It looks like this (I removed other metadatas):

.nuspec

<?xml version="1.0" encoding="utf-8"?>
<package>
  <metadata>
    ...
    <references>
      <reference file="First.dll" />
      <reference file="Second.dll" />
    </references>
  </metadata>
  <files>
    <file src="SomePath\First.dll" target="lib\First.dll" />
    <file src="SomePath\Second.dll" target="lib\Second.dll" />
  </files>
</package>

这篇关于如何继承 NuGet 包中引用的程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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