Trying to generate a Nuget Package from dll. One of our project is generating ConfigurationCore.dll and References of project assemblies given below
Using below ConfigurationCore.nuspec to generate Nuget Package
<?xml version="1.0"?>
<package >
<metadata>
<id>ConfigurationCore</id>
<version>1.2.0</version>
<title>Configuration Core</title>
<authors>MAKK</authors>
<owners>IT Department</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>ConfigurationCore contains core funcationality of Software</description>
<releaseNotes></releaseNotes>
<copyright>Copyright 2018</copyright>
<dependencies>
<dependency id="Newtonsoft.Json" version="10.0.3" />
</dependencies>
</metadata>
<files>
<file src="C:\Users\makk\source\repos\ConfigurationCore\bin\x86\Test\ConfigurationCore.dll" target="lib\net461" />
</files>
</package>
Attempting to gather dependency information for package 'ConfigurationCore.1.2.0' with respect to project 'NugetTest', targeting '.NETFramework,Version=v4.6.1' Gathering dependency information took 1.09 sec Attempting to resolve dependencies for package 'ConfigurationCore.1.2.0' with DependencyBehavior 'Lowest' Resolving dependency information took 0 ms Resolving actions to install package 'ConfigurationCore.1.2.0' Resolved actions to install package 'ConfigurationCore.1.2.0' The V2 feed at 'http://builtsrv1:8080/nuget/FindPackagesById()?id='ConfigurationCore'&semVerLevel=2.0.0' returned an unexpected status code '404 Not Found'. Time Elapsed: 00:00:02.1513344 ========== Finished ==========
Note: The Nuget package source is on local harddrive... Please advise to fix the issue.
Update your Nuget package link.
Go to Project -> Manage Nuget Packages.
Now click on your package source settings.
Update Source Link to https://api.nuget.org/v3/index.json
Your URL should end with /nuget
Example: http://yourDomain.co/yourNuGetServer/nuget
This is problem of bad connection in the NuGet package. Add the following link into the NuGet Package. https://api.nuget.org/v3/index.json Tha
Nuget returned an unexpected status code '404 Not Found' - Package on local drive
Make sure the path in the src="..."
is correct.
Perhaps the path should be:
...\ConfigurationCore\ConfigurationCore\...
rather than ...\ConfigurationCore\...
.
In short, make sure you can find the dll file base on that url.
Note: Generally, we recommend using relative paths in url, like:
<file src="bin\x86\Test\ConfigurationCore.dll" target="lib\net461" />
Update the version of nuget.exe
.
There is an issue on the nuget.exe 3.4.x, so please download nuget.exe 3.5 and above.
See Create nuget package from dlls for more detailed info.
Update: Please following below steps to create the nuget package:
Download the nuget.exe, and set it on your local, for example, D:\NuGetLocalFolder
.
Create a new project with project name "ConfigurationCore".
Open a cmd and switch to the path where nuget.exe was stored previously.
Use command line:
nuget spec "C:\Users\<Username>\Source\repos\ConfigurationCore\ConfigurationCore\ConfigurationCore.csproj"
You will find the .nuspec
be genererated, Do not close this CMD window.
Edit the ConfigurationCore.csproj.nuspec
file and modify it, below is my .nuspec file:
<?xml version="1.0"?>
<package >
<metadata>
<id>ConfigurationCore</id>
<version>1.2.0</version>
<title>Configuration Core</title>
<authors>MAKK</authors>
<owners>IT Department</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>ConfigurationCore contains core funcationality of Software</description>
<releaseNotes></releaseNotes>
<copyright>Copyright 2018</copyright>
<dependencies>
<dependency id="Newtonsoft.Json" version="10.0.3" />
</dependencies>
</metadata>
<files>
<file src="C:\Users\Admin\Source\repos\ConfigurationCore\ConfigurationCore\bin\x86\Test\ConfigurationCore.dll" target="lib\net461" />
</files>
</package>
Save ConfigurationCore.csproj.nuspec
file, and back to your CMD window, using pack command to generate the nuget package:
The package ConfigurationCore.1.2.0.nupkg
was created into the folder where nuget.exe exists, D:\NuGetLocalFolder
.
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