I'm working on a .NET cli tool. The created nuget package contains a deps.json. This deps.json file contains entries for all referenced nuget packages.After installing the tool dotnet tool install..
I can not run the tool dotnet tool run
because an assembly listed in the deps.json file is missing
An assembly specified in the application dependencies manifest (xxxx.deps.json) was not found:package: 'Microsoft.Win32.SystemEvents', version: '4.7.0'path: 'runtimes/win/lib/netcoreapp3.0/Microsoft.Win32.SystemEvents.dll'
The package contains a runtimes/win/lib/netcoreapp3.0
folder but not Microsoft.Win32.SystemEvents.dll
The Problem seems to be the entries in deps.json for GitVersion.MsBuild
. Because if I either remove this dependency or delete deps.json the application works as expected.
- Why is a dev dependency
<PrivateAssets>all</PrivateAssets>
included in deps.json? - How can i exclude deps.json from package and is this a good idea?
csprj:
<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><OutputType>Exe</OutputType><TargetFramework>netcoreapp3.1</TargetFramework><PackAsTool>true</PackAsTool><IncludeBuildOutput>false</IncludeBuildOutput><PackageId>xxxxxxx</PackageId><ToolCommandName>xxxxx</ToolCommandName><PackageOutputPath>..\..\artifacts</PackageOutputPath></PropertyGroup><ItemGroup><PackageReference Include="CommandLineParser" Version="2.8.0" /><PackageReference Include="GitVersion.MsBuild" Version="5.6.6"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets></PackageReference><PackageReference Include="NuGet.ProjectModel" Version="5.8.1" /></ItemGroup></Project>
deps.json snippet:
"GitVersion.MsBuild/5.6.6": {"dependencies": {"Microsoft.Build.Utilities.Core": "16.8.0" } }, // snipp.."Microsoft.Win32.SystemEvents/4.7.0": {"dependencies": {"Microsoft.NETCore.Platforms": "3.1.0" },"runtimeTargets": {"runtimes/win/lib/netcoreapp3.0/Microsoft.Win32.SystemEvents.dll": {"rid": "win","assetType": "runtime","assemblyVersion": "4.0.2.0","fileVersion": "4.700.19.56404" } } }