Problem

I noticed when playing around with scriptcs on my laptop that I wasn’t able to install any Script Packs at all. They would fail with the following error message:

Error message

I tried it on a few other machines and it worked fine. So I fired up Process Monitor on both machines and compared the logs. The first thing that stood out was on my laptop it was looking in C:\Program Files (x86)\Microsoft SDKs\NuGetPackages.

ProcMon

I also tried the command line version of Nuget and was able to resolve packages without problems.

Nuget Configuration

From looking at the above information it became apparent that the problem was some how related to how ScriptCS and Nuget interact. I had looked at a Configuration in my profile for nuget (%localappdata%\nuget) and couldn’t see any reference to C:\Program Files (x86)\Microsoft SDKs\NuGetPackages.

So I decided to look in Process Monitor to try and find more config files or registry keys nuget could be using. Which was when I found this entry:

ProcMon

Looking in C:\ProgramData\NuGet\Config lead me to the Microsoft.VisualStudio.Offline.config file.

ProcMon

Bingo this file contained the reference to C:\Program Files (x86)\Microsoft SDKs\NuGetPackages that was tripping ScriptCs up.

So I renamed the file to Microsoft.VisualStudio.Offline.config.old and was now able to resolve packages as expected.

ProcMon