Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3079

Include assembly from another package into my NuGet package using GeneratePathProperty

$
0
0

I am building a tool package which depends on another NuGet package. As it is not an usual library, it must include all dependencies into the tools\ directory. I have the following csproj (only the relevant bits are shown):

<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks><GeneratePackageOnBuild>true</GeneratePackageOnBuild><DevelopmentDependency>true</DevelopmentDependency><IsTool>true</IsTool></PropertyGroup><ItemGroup><PackageReference Include="Microsoft.Build.Framework" Version="16.7.0" PrivateAssets="all" /><PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.7.0" PrivateAssets="all" /><PackageReference Include="System.Text.Json" Version="4.7.2" PrivateAssets="all" GeneratePathProperty="true" /></ItemGroup><ItemGroup><None Include="build\*" Pack="true" PackagePath="build\" /><None Include="$(PkgSystem_Text_Json)\lib\netstandard2.0\*.dll" Visible="false" Pack="true" PackagePath="tools\" /></ItemGroup></Project>

So I used GeneratePathProperty on my dependency and try to include the assembly using generated path $(PkgSystem_Text_Json). I can confirm that the path is correct by setting Visible="true" and inspecting my project. But the assembly is missing from my NuGet package. Seems that the generated path property does not exist at the moment of packaging. If I use an absolute path the assembly gets included but this solution is not portable.

How do I make generated path property work at packaging stage?


Viewing all articles
Browse latest Browse all 3079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>