简体   繁体   中英

How To Add NuGet Source Only Package Dependencies

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.

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:

在此处输入图像描述

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?

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>

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.

for Exclude:

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".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM