Question

I'm trying to install a simple nuget-package programatically. I have created a package with a Site.css file in it. So it resides in the content folder of the package.

Using this code

public void TestInstall(string packageID, string physicalPath)
{
   var rep = PackageRepositoryFactory.Default.CreateRepository(new PackageSource("http://nuget.testserver.lan/nuget", "Default"));

   var packagemgr = new PackageManager(
                rep,
                new DefaultPackagePathResolver("http://nuget.testserver.lan/nuget"),
                    new PhysicalFileSystem(physicalPath)
                    );

   var package = rep.FindPackagesById(packageID).First();

   packagemgr.InstallPackage(package, false);
}

Lets say I provide packageID = 'Testpackage' and physicalPath = 'c:\inetpub\test' it creates:

c:\Inetpub\test\Testpackage

and that folder contains:

the content folder with the Site.css AND the Testpackage.0.1.nupkg

Not quite what I'm trying to do but sort of :)

Is it possible to change it so:

  • I can specify where it should place the package for its cache-functionality

  • Make it place whatever resides in the content folder to the specified path?

  • If the package contains dll's in the lib-folder have them go in the bin-directory (create if not exist)

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top