如何添加NuGet仅源软件包依赖关系 [英] How To Add NuGet Source Only Package Dependencies

查看:43
本文介绍了如何添加NuGet仅源软件包依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个已创建的框架,可以与Microsoft的CRM/XRM/CDS/PowerPlatform/DataVerse插件一起使用.这些插件不能包含对外部非.Net Framwork非MicrosoftSDK dll的任何依赖关系.我没有使用ILMerging依赖项,而是使用了NuGet的仅源软件包,该软件包允许通过NuGet共享源文件本身,从而消除了对其他dll的引用和ILMerging的需要.

I have a framework that I've created to be used with Microsoft's CRM/XRM/CDS/PowerPlatform/DataVerse plugins. These plugins can not contain any dependencies on external non-.Net Framwork non-MicrosoftSDK dlls. Rather than ILMerging dependencies I've made use of NuGet's Source Only Packages that allow the source files themselves to be shared via NuGet, removing the need for referencing and ILMerging other dlls.

我正在尝试使这些NuGet软件包与dotnetcore兼容.有两个nuget包DLaB.Xrm.Source和DLaB.Common.Source.DLaB.Xrm.Source取决于DLaB.Common.Source.我能够为dotnetcore的Common软件包成功更新Nuget软件包,并且一切看起来都很棒.然后,我更新了dotnetcore的Xrm程序包,但是当我测试仅安装DLaB.Xrm.Source程序包时,它似乎没有添加DLaB.Common.Source程序包,因为现在我遇到了那些缺少的构建错误文件,即使它被列为依赖项:

I'm attempting to make these NuGet Packages dotnetcore compatible. There are two nuget packages DLaB.Xrm.Source and DLaB.Common.Source. DLaB.Xrm.Source depends on DLaB.Common.Source. I was able to successfully update the Nuget Package for the Common package for dotnetcore, and everything looks great. I then updated the Xrm package for dotnetcore, but when I tested installing just the DLaB.Xrm.Source Package, it doesn't appear to have added the DLaB.Common.Source Package, since now I'm getting build errors for those missing files, even though it is listed as a dependency:

我错过了什么吗?有什么方法可以使它起作用,还是应该撑腰而只将DLaB.Common.Source文件直接包含在DLaB.Xrm.Source文件中?

Am I missing something? Is there a methodology to get this to work, or should I punt and just include the DLaB.Common.Source files in the DLaB.Xrm.Source files directly?

这是我在NuSpec文件中列出的依赖项的方式:

This is how I have the dependencies listed in my NuSpec file:

<dependencies>
  <group targetFramework="net">
    <dependency id="DLaB.Common.Source" version="1.2.0.10" />
  </group>
  <group targetFramework="netcoreapp">
    <dependency id="DLaB.Common.Source" version="1.2.0.10" />
  </group>
</dependencies>

推荐答案

这看起来像是为NuGet设计的.据此:

Looks like this is by design for NuGet. According to this:

https://docs.microsoft.com/en-us/nuget/reference/nuspec#dependencies-element

内容文件被排除在外,因此我很可能必须在父级文件中包含依赖项的源文件.

Content files are excluded, so I will most likely have to include the source files of the dependency in the parent.

排除:

包含/排除标记的逗号分隔列表(见下文),指示最终包中要排除的依赖项.默认值是构建,可以覆盖的分析器.但是内容/在最终包中,内容文件也被隐式排除在外不能被覆盖.用排除指定的标签优先超过包含指定的内容.例如,include =运行时,编译"exclude =编译"与include ="runtime"相同.

A comma-delimited list of include/exclude tags (see below) indicating of the dependency to exclude in the final package. The default value is build,analyzers which can be over-written. But content/ ContentFiles are also implicitly excluded in the final package which can't be over-written. Tags specified with exclude take precedence over those specified with include. For example, include="runtime, compile" exclude="compile" is the same as include="runtime".

这篇关于如何添加NuGet仅源软件包依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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