簡體   English   中英

當間接引用為 NuGet 依賴項時,未復制本機依賴項

[英]Native dependencies not copied when indirectly referenced as a NuGet dependency

我有一個內部 NuGet package 依賴於另一個 NuGet ZEFE90A8E604A7C840E8ZD8D 具有本機依賴項6。 In a .NET SDK console application I am referencing the internal NuGet package and indirectly referencing the other NuGet package that has the native dependencies.

當間接引用帶有原生依賴的 NuGet package 時,原生依賴不會正確復制到 bin 目錄。

如果將帶有本機依賴項的 NuGet package 作為直接依賴項直接安裝,則本機依賴項將被正確復制。

Will this always be the case, and we just need to add the NuGet package with native dependencies as a direct dependency to any project using our internal NuGet package? Or is there something that could be added to our internal NuGet package or something that could be added to the other NuGet package to get native dependencies to copy correctly when referenced indirectly?

我們的內部 NuGet package 是使用dotnet pack構建的,使用來自 csproj 文件的信息來創建 NuGetF8407D8E604E7A。

我能夠使用此處描述的 package 參考修飾符來解決此問題Controlling dependency assets

PrivateAssets的默認設置是防止內容文件、分析器和構建文件傳播到引用項目。 本機文件位於 NuGet package 的構建文件夾中,我將其與 .targets 文件一起引用以定義需要復制的文件。 PrivateAssets更改為僅排除內容文件和分析器解決了下游項目無法正確復制本機文件的問題。

<PackageReference Include="SomeLibraryWithNativeDependenciesInTheBuildFolder" Version="1.2.3">
  <PrivateAssets>contentfiles,analyzers</PrivateAssets>
</PackageReference>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM