Nuget in Visual studio can't access a custom package source location on a shared network drive. I am able to browse the nuget.org and microsoft packages just fine. I just can't browse the local network share we have setup for custom nuget packages. When I try I get the error:
the path '\\someserver\somefolder' for the selected source could not be resolved
I am able to access the file location through explorer and a mapped drive. I tried removing and re-adding the network location in nuget package manager, but when I try to re-add it, I can't see the mapped network drive or use the full unc path (it throws error that the network location doesn't exist).
The default source is nuget.org, which has the following package source URL: https://api.nuget.org/v3/index.json .
Open PowerShell as administrator. Run the command Install-Module PowerShellGet -Force to install the NuGet package. When asked for confirmation to install the NuGet provider, press the Y key and press Enter .
Finally!... the answer!
The problem was running visual studio as administrator.
The network share nuget was trying to access required my own user credentials, but running visual studio as administrator uses the local administrator credentials which didn't have access to the share.
There are a few ways to prevent VS from running as administrator (ex: if you're using a shortcut you need to go to properties and uncheck "run as administrator"), but since I had ran the compatibility troubleshooter on devenv.exe to force it to always run as admin, I didn't know how to undo it. This link shows you how to do that:
https://superuser.com/a/547846/213179
Note: to see other reasons why not to run visual studio as administrator, read the posted question in the above link:
"For those interested, the reason I want to go back is because some features (such as drag-and-drop files into VS, open files from Windows Explorer, etc.) no longer work."
Package Source must be given as wrong path. Try this
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With