I have a project I'd like to put all my dependencies into one nuget package. The idea is that when I need to I can just pull in that one nuget package instead of 10 that I require. Is this possible to do?
When I created a library I removed the class file and just pulled in the dependencies but could not get a package to create.
You can do this by setting the IncludeBuildOutput
property to false
while creating the package.
For example [using VS 2017] -
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net46</TargetFramework> <PackageId>MetaPackage</PackageId> <GeneratePackageOnBuild>true</GeneratePackageOnBuild> <IncludeBuildOutput>false</IncludeBuildOutput> </PropertyGroup> <ItemGroup> <PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> <PackageReference Include="NuGet.Versioning" Version="4.7.0-rtm.5104" /> <PackageReference Include="NUnit" Version="3.10.1" /> </ItemGroup> </Project>
<project_dir>\bin\Debug\MetaPackage.1.0.0.nupkg
This will create a package that has no \lib
and the nuspec file should have package reference dependencies.
You can read more about IncludeBuildOutput
here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With