I have a .NET Standard class library project that's being packaged into a nuget package. It has a dependency on Newtonsoft.Json.
I built the nuget package by checking the "Generate nuget package on build" on the project properties, under the package tab.
I also tried doing nuget pack. Here's my nuspec:
<?xml version="1.0" encoding="utf-8"?>
<package >
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<projectUrl>http://project_url_here_or_delete_this_line/</projectUrl>
<iconUrl>http://icon_url_here_or_delete_this_line/</iconUrl>
<description>$description$</description>
<releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
<copyright>Copyright 2020</copyright>
<tags>Tag1 Tag2</tags>
<dependencies>
<dependency id="Newtonsoft.Json" version="12.0.3" />
</dependencies>
</metadata>
</package>
Then I ran this:
nuget pack -Prop Configuration=Release -IncludeReferencedProjects
Then I have a .NET Framework 4.8 project and we added the .NET Standard nuget package to it. The problem is that I'm getting the following error:
FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
I needed to add the Newtonsoft.Json in nuget package manager manually to the .NET Framework project. It's not being installed when I install the .NET Standard nuget package.
How can I build a .NET Standard nuget package that will resolve its dependencies automatically?