I want to create a nuget package which adds multiple .dll as references to my project.
I would like give you two solutions to achieve this:
First, Use NuGet Package Explorer:
- Download the NuGet Package Explorer.
- Open the NuGet Package Explorer, select the create a new package.
- Add a lib folder on the content tab, and add your dlls file
- Save the package and install it to the project, check if it add references.
Second, Just as Lex Li mention, We could use .nuspec to pack up the assemblies:
-
Download the nuget.exe.
-
Create a new project.
-
Open a cmd and switch path to nuget.exe
-
Use command line:
nuget spec "PathOfProject\TestDemo.csproj"
-
Open the
TestDemo.csproj.nuspec
file and modify it and add the assemblies as file; below is my .nuspec file:<?xml version="1.0"?> <package> <metadata> <id>TestDemo</id> <version>1.0.0</version> <authors>Tester</authors> <owners>Tester</owners> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>TestDemo</description> <releaseNotes>Summary of changes made in this release of the package.</releaseNotes> <copyright>Copyright 2017</copyright> <tags>Tag1 Tag2</tags> </metadata> <files> <file src="MultipleDll\*.*" target="lib\net461" /> </files> </package>
-
Use pack command:
nuget pack TestDemo.csproj.nuspec
-
Open the TestDemo package by NuGet Package Explorer.