I'm trying to create Nuget package from a Visual Studio 2017 class Library first time. It is a .NET Framework 4.6.2 project. The class library is referencing some other nuget packages, dlls, exes which are in References section under Solution Explorer.
Here are the steps I took after looking at some youtube videos and Microsoft documentation:
Right click project and select Properties. Build option, set Configuration to Release. Saved and closed project properties. Opened csproj file and changed Configuration to Release
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
Now build the project in Release mode. I can see dlls under
MyProject\bin\Release and also under MyProject\bin\Debug
Then I create the spec file using
nuget spec Opened it and made appropriate changes and then
nuget pack MyProject.nuspec
I am getting number of warnings like both for Debug and Release directory:
WARNING: NU5100: The assembly 'bin\Debug\Encryption.dll' is not inside the 'lib' folder and hence it won't be added as a reference when the package is installed into a project. Move it into the 'lib' folder if it needs to be referenced.
although the Class Library (which I am creating Nuget), has a packages.config and has references:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Encryption" version="1.1.0" targetFramework="net462" />
...
...
...
<package id="TeraData" version="16.20.8" targetFramework="net462" />
</packages>
Since I am getting warnings, I tried entering dependency information in the nuspec file. Here is what my nuspec file looks like
<?xml version="1.0" encoding="utf-8"?>
<package >
<metadata>
<id>ProjectTitle</id>
<version>1.0.0</version>
<title>ProjectTitle</title>
<authors>auther name</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>desc of package</description>
<releaseNotes>release notes text</releaseNotes>
<copyright>Copyright info</copyright>
<tags>some tages</tags>
<dependencies>
<dependency id="Encryption" version="1.1.0" />
...
<dependency id="TeraData" version="16.20.8" />
</dependencies>
</metadata>
</package>
But still get same warnings. If you can please provide a sample how dependency info in nuspec should look like, that would really help! Please advise if I'm missing anything!