Search code examples
nugetvsixnuget-server

How to add Nuget Package Source at runtime?


I have a Nuget.Server http://localhost/ABC. I have to use this as feed in a project. I can ask user to input the URL to Nuget server now how can I add it and use it in same session in C#? I don't want to add manually to Package Manager.

I have an application XYZ which is launched and asks user URL to Nuget.Server. Then it will add this to feed and later call

installer.InstallPackage("All", project, "myPackage", (Version)null, false);

How can I do this?


Solution

  • Create a installer which will take the the Nuger Server URL and call Nuget.exe sources add -Name -Source \nuget