I have a netstandard2.0 nugget package that has some dependencies:
<!-- Nugget Package dependencies --><ItemGroup><PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="All" /><PackageReference Include="Serilog" Version="2.9.0" PrivateAssets="All" /><PackageReference Include="Newtonsoft.Json" Version="12.0.3" PrivateAssets="All" /><PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.13" PrivateAssets="All" /><PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" PrivateAssets="All" /><PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" PrivateAssets="All" /><PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" PrivateAssets="All" /><PackageReference Include="Serilog.Sinks.File" Version="4.1.0" PrivateAssets="All" /></ItemGroup>
Every time I install this package on a another project, it adds it's dependencies, like:
<ItemGroup><Reference Include="PackageXPTO, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"><HintPath>..\packages\PackageXPTO.1.1.0\lib\netstandard2.0\PackageXPTO.dll</HintPath></Reference><Reference Include="JetBrains.Annotations, Version=2020.1.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL"><HintPath>..\packages\PackageXPTO.1.1.0\lib\netstandard2.0\JetBrains.Annotations.dll</HintPath></Reference><Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"><HintPath>..\packages\PackageXPTO.1.1.0\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath></Reference><Reference Include="Newtonsoft.Json.Schema, Version=3.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"><HintPath>..\packages\PackageXPTO.1.1.0\lib\netstandard2.0\Newtonsoft.Json.Schema.dll</HintPath></Reference><Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL"><HintPath>..\packages\PackageXPTO.1.1.0\lib\netstandard2.0\Serilog.dll</HintPath></Reference><Reference Include="Serilog.Enrichers.Thread, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL"><HintPath>..\packages\PackageXPTO.1.1.0\lib\netstandard2.0\Serilog.Enrichers.Thread.dll</HintPath></Reference> (...)
This is messing with a project that I have that already depends on Newtonsoft.Json: the old dependency will now be related to the nugget and not a direct dependency: so, on the future, if this nugget no longer deppends on the Newtonsoft.Json, the dependency will be removed, but the project actually needs it.
Package configurations:
<PropertyGroup><AssemblyName>PackageXPTO</AssemblyName><RootNamespace>PackageXPTO</RootNamespace><TargetFramework>netstandard2.0</TargetFramework><Version>1.1.0</Version><SignAssembly>true</SignAssembly><AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath><AppxAutoIncrementPackageRevision>true</AppxAutoIncrementPackageRevision><CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies><GenerateAssemblyInfo>true</GenerateAssemblyInfo><LangVersion>7.2</LangVersion><PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance><GeneratePackageOnBuild>true</GeneratePackageOnBuild><GenerateDocumentationFile>true</GenerateDocumentationFile><GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute><TreatWarningsAsErrors>true</TreatWarningsAsErrors><TreatSpecificWarningsAsErrors /><PublishRepositoryUrl>true</PublishRepositoryUrl><EmbedUntrackedSources>true</EmbedUntrackedSources><IncludeSymbols>true</IncludeSymbols><SymbolPackageFormat>snupkg</SymbolPackageFormat><TargetsForTfmSpecificBuildOutput>IncludeDependentDlls</TargetsForTfmSpecificBuildOutput></PropertyGroup>
Already tried to merge built .dll files, but didn't work
<!-- Auto bundler - used to apply package reference dll files --><!-- Include all .dll files under build directory, excluding the self one (to avoid errors) --><Target Name="IncludeDependentDlls" DependsOnTargets="ResolveReferences"><ItemGroup><BuildOutputInPackage Include="$(OutputPath)\*.dll" Exclude="$(OutputPath)\$(AssemblyName).dll" /></ItemGroup></Target>