Note to myself for future for this issue: After making some changes to an application, I went to publish it using Visual Studio, as a ClickOnce application. On trying to install the resulting published application I got presented with the following error.
Unable to install or run the application. The application requires that assembly Newtonsoft.Json Version 18.104.22.168 be installed in the Global Assembly Cache (GAC) first.
I searched for any reference, or mention of the NewtonSoft 6 version but found nothing, anywhere in any projects involved. There was a old folder in the NUGET cache for it, so it had been in use at some point.
Totally stumped, the breakthrough came when looking at the build log. There were warnings in there about the version of Newtonsoft.
Ah – that makes more sense, so I added a mapping into the app.config.
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-22.214.171.124" newVersion="10.0.0.0"/>
After publishing the application launched correctly again.
There must be some 3rd party dependency somewhere that is looking to the old version but I can’t track it down. Remember ClickOnce applications run in a sandbox.
** If you found this useful, drop me a comment to let me know, as it motivates me to blog more!