Permission Issues with Nuget.Core in a WebApplication

When working with Nuget.Core in a web application one might face problems with the Machine Cache settings of Nuget. Heres a way to change the Cache Path to within your web application.
 Environment.SetEnvironmentVariable("NuGetCachePath", Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.CacheDirectory), "nuget"));

I am using this in Composite C1 for a Package that I am working out. You can set the path to use App_Data or something like that if you want the cache path to be within the application path where the process running the application has write access. The problem is if this is not set, it will try to use a path like this:

Caption: The path used by default in Nuget.Core

comments powered by Disqus