[英]How To Add NuGet Source Only Package Dependencies
我创建了一个框架,用于与 Microsoft 的 CRM/XRM/CDS/PowerPlatform/DataVerse 插件一起使用。 这些插件不能包含对外部非 .Net Framwork 非 MicrosoftSDK dll 的任何依赖。 我没有使用 ILMerging 依赖项,而是使用了 NuGet 的 Source Only Packages,它允许通过 NuGet 共享源文件本身,从而无需引用和 ILMerging 其他 dll。
我正在尝试使这些 NuGet 软件包与 dotnetcore 兼容。 有两个 nuget 包 DLaB.Xrm.Source 和 DLaB.Common.Source。 DLaB.Xrm.Source 依赖于 DLaB.Common.Source。 我能够成功地更新 Nuget Package 用于 dotnetcore 的 Common package,一切看起来都很棒。 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文件,即使它被列为依赖项:
我错过了什么吗? 有没有一种方法可以让这个工作,或者我应该直接将 DLaB.Common.Source 文件包含在 DLaB.Xrm.Source 文件中?
这就是我在 NuSpec 文件中列出依赖项的方式:
<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 设计的。 根据这个:
https://docs.microsoft.com/en-us/nuget/reference/nuspec#dependencies-element
内容文件被排除在外,因此我很可能必须在父项中包含依赖项的源文件。
排除:
包含/排除标签的逗号分隔列表(见下文),指示要在最终 package 中排除的依赖项。 默认值为 build,analyzers 可以被覆盖。 但是 content/ ContentFiles 也被隐式地排除在不能被覆盖的最终 package 中。 用 exclude 指定的标签优先于用 include 指定的标签。 例如,include="runtime, compile" exclude="compile" 与 include="runtime" 相同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.