Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Install a Nuget package programmatically

$
0
0

I found this blog post by the Nuget team showing how you can install a nuget package programmatically. I've essentally created the same thing in my code however I want to install to the default $(SolutionDir)\packages folder.

// Install the TemplateBuilder Nuget pkg into the target project
string packageID = "TemplateBuilder";
IPackageRepository repo = PackageRepositoryFactory.Default.CreateRepository("https://packages.nuget.org/api/v2");

string installPath = ""; // Somehow need to get $(SolutionDir)\packages of the target project
PackageManager packageManager = new PackageManager(repo, installPath);
packageManager.InstallPackage(packageID);

Does anyone know how to set the path as the default location?




Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>