Search code examples
nugetnuget-packagepackage-managersnuget-package-manager-console

Nuget Package Manager: "...is not a valid JSON object"


I setup a Nexus repo 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 VS2022 package manager on one machine. On my other machine, however (also with VS2022 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 configuration AppData/Roaming/Nuget/Nuget.config remove protocol version or change to 2 for your feed. Probably you have protocolVersion="3".