0

I am following this tutorial for creating a custom Visual Studio extension. I just installed the Visual Studio extension development workload, and I'm using Visual Studio 2022 version 17.12.

I just finished the step Add a custom command and I'm trying to fix compilation errors. One says Local source 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages' does not exist.

If I go to Tools > Options > NuGet Package Manager, this is what I see:

enter image description here

The selected path exists. All I know is that the path that appears in the error message is the one described by the "fallback config", but I don't know why that would point to a non-existent path.

Can someone help me understand what's going on and how to fix this error? I don't know much about NuGet.

1 Answer 1

0

From looking at your error message, looks like that Visual Studio is trying to access a local NuGet package source that doesn't exist on your machine. For this issue, here are suggestions you can troubleshoot:

  1. Please check if the path C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages exists on your machine. Looks like it's different from the path C:\Program Files (x86)\Microsoft SDKs\NuGetPackages in your Package Sources. If it does not exist, create C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages directory.

  2. The package source is defined in Nuget.config file(Windows: %appdata%\NuGet\NuGet.Config).You should see under a package sources element an add element that adds that file path. Comment out or delete that line.

 <packageSources>
    <add key="local" value="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages" />
  </packageSources>
  1. You can also go to Tools > Options > NuGet Package Manager Under Package Sources, find the entry for C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages and remove it or update it to a valid path.

  2. After doing that, run dotnet restore --verbosity normal to restore your packages.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.