nugetnexuspackage-manager-console

Nuget Package Manager returning "The content is not a valid JSON object"


I setup a Nexus repository recently. I see the expected result if I type the URL into a browser:

enter image description here

I've successfully added this NuGet server as a source to my Visual Studio 2022 package manager on one machine. On my other machine, however (also with VS 2022 installed), I get an error when trying to browse this repo in the package manager:

Error [sourcename] Unable to load the service index for source [url].
The content at '[url]' is not a valid JSON object.
Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

It looks like the package manager is expecting JSON, but the NuGet server is sending XML. How can I fix this?


Solution

  • On Windows in your AppData/Roaming/Nuget/Nuget.config file, remove the protocol version, or change it to 2 for your feed. You probably have protocolVersion="3" set.