1

I am trying to get a self hosted NuGet server working, the idea is to keep small libraries to use in multiple projects.

I am using NuGet.Server (https://www.nuget.org/packages/NuGet.Server/ https://docs.nuget.org/create/hosting-your-own-nuget-feeds) to do this, and it seems to be working.

The problem I have, is when I then try and add the package to a project (after adding the URL to Package Source in Visual Studio), it tries to add the package, but it fails on dependencies (e.g. System.Linq). It tries getting the dependency from my hosted source, and not from nuget.org.

Is there a way to get it to use nuget.org, or at least look at other sources for dependencies?

I have tried setting Package Source to "All", and I still get the same problem. I have also tried installing through the Package Management Console.

JonathanPeel
  • 743
  • 1
  • 7
  • 19

1 Answers1

1

You need to install the dependencies when you create your packages. I do with following steps and it successful install the package and its dependencies on my project from my own NuGet Server.

  1. Create a project.
  2. Install the dependencies packages on your project through Package Manager.
  3. Create spec file for your package with command “nuget spec” through nuget.exe.
  4. Pack your project with command “nuget pack YourProject.csproj”.
  5. Upload this package to your NuGet Server and then you can install it through the Package Manager from your added package source.

The detailed steps about pack the packages with nuget.exe, you could refer to: https://docs.nuget.org/create/creating-and-publishing-a-package

And you also can use NuGet Package Explorer to assign the dependencies more easily. http://www.marcusoft.net/2011/09/creating-local-nuget-repository-with.html

Weiwei
  • 3,674
  • 1
  • 10
  • 13
  • Thank you for the reply, I will give this a try. – JonathanPeel Aug 29 '16 at 10:41
  • thank you. I followed your steps, but I am still getting the same error. I do see my name, and tags, etc from the nuspec file in the package management console, so I do know the package was built with that. The error message I am getting is `Package 'Igs.Core.1.0.0 : System.Linq [4.1.0, ), System.Linq.Queryable [4.0.1, )' is not found on source 'http://p.abmt.co.uk/NuGet/nuget'.` – JonathanPeel Aug 30 '16 at 13:33
  • I suggest you provide the detailed steps about how do you create your package and which specific dependencies installed on your package. I will try your operations in my side to reproduce your issue. – Weiwei Aug 31 '16 at 00:44
  • Hi @Wendy I created a few more projects to test this. The first one worked without a problem, I followed your steps, added it to the server and added it to a project (with a reference, I used Newtonsoft as an example). I then tried again with a .Net Core project, and that seems to be where my problem is. I built the package (using `dotnet pack`), uploaded it, and I got the error: `Package 'Test.Core.1.0.0 : Newtonsoft.Json [9.0.1, )' is not found on source 'http://server.name.com/NuGet/nuget'.`. Do you know if there is anything different that needs to get done? – JonathanPeel Sep 13 '16 at 08:54
  • I have this exact issue. I am creating a nuget that references EntityFramework and I am pushing it to a local Nuget server running at http://mylocalnuget on my machine. It says Package 'ClassLibrary1.1.0.0 : EntityFramework [6.2.0, )' is not found on source 'http://mylocalnuget/nuget'. Were you able to resolve this? The exact same code base and commands to pack and push worked for me till Visual Studio 2017 15.3. This has been happening since update 15.4. – Abhishek Tiwari Nov 16 '17 at 20:08