Add external project in nuget .nuspec file

I have an external .NET Core library that I want to include as a reference in a NuGet package I'm creating using a .nuspec file. Below is the folder structure I'm using. What else do I need to add to make sure that when someone installs this package, the .NET Core library is also automatically added as a reference?
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>YourProject.Id</id>
<version>1.0.0</version>
<title>Your Project Title</title>
<authors>Your Name</authors>
<owners>Your Organization</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<projectUrl>https://yourprojectsite.com</projectUrl>
<!-- <icon>icon.png</icon> -->
<description>A brief description of your project.</description>
<dependencies>
<group targetFramework=".NETFramework4.8">
<!-- Dependencies here -->
</group>
</dependencies>
</metadata>
</package>
My goal is that when someone installs the package, the external library is automatically added as a reference
Answer
If you have any external project that you've referenced, you can add it as a file, just like I added the Alleva.B2C.dll
file.
<?xml version="1.0" encoding="utf-8"?>
<package >
<metadata>
<id>Alleva.B2C.Legacy</id>
<version>1.1.3</version>
<title>Alleva.B2C.Legacy</title>
<authors>John</authors>
<owners>Hello Alleva</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<projectUrl></projectUrl>
<!-- <icon>icon.png</icon> -->
<description>Project decription</description>
<dependencies>
<group targetFramework=".NETFramework4.8">
</group>
</dependencies>
<releaseNotes></releaseNotes>
<copyright>Copyright 2024</copyright>
</metadata>
<files>
<file src="..\Alleva.B2C\bin\Release\netstandard2.0\Alleva.B2C.dll" target="lib\net48" />
<file src="bin\Release\Alleva.B2C.Legacy.dll" target="lib\net48" />
</files>
</package>
Enjoyed this article?
Check out more content on our blog or follow us on social media.
Browse more articles