I am trying to build a proof of concept code to show that it would be possible to use NuGet packages along with a community MyGet feed for a package repository for the CMS Umbraco.
I have this following code snippet inside a WebAPI Controller for now
public bool GetPackageInstall()
var repo = PackageRepositoryFactory.Default.CreateRepository("https://packages.nuget.org/api/v2");
var path = new DefaultPackagePathResolver("https://packages.nuget.org/api/v2");
var fileSystem = new PhysicalFileSystem(HostingEnvironment.MapPath("~/"));
//Create a NuGet Package Manager
var packageManager = new PackageManager(repo, path, fileSystem);
bool isInstalled = false;
var packageVersion = SemanticVersion.Parse("2.0.3");
//Install the package...
packageManager.InstallPackage("jQuery", packageVersion, false, false);
//Set flag to true
isInstalled = true;
//Some error - set flag to false
isInstalled = false;
//Returned bool if it's installed or not
So with the above code snippet it works to some extent, but is perhaps the results are not quite what I expected.
When running this I get a new folder in the root called jQuery.2.0.3 which contains the Content & Tools folder and the .nupkg file inside as well.
I have checked the Scripts folder at the root and the jQuery file has not been copied into the folder as I would have expected.
What I would like ideally to do is for the jQuery.2.0.3 package folder to be created at
for example and the NuGet package to be executed at the root so any files need to be copied over do so from the root directory of the site.
One final thing is would I need to generate myself manually a list of packages that gets installed into the site, or is there a way for me to generate a packages.config file similar to how installing packages using Visual Studio.
I look forward to hearing your thoughts.