Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Octopus.Client JSON mismatch #626

Closed
PaulStovell opened this issue Feb 7, 2014 · 6 comments
Closed

Octopus.Client JSON mismatch #626

PaulStovell opened this issue Feb 7, 2014 · 6 comments

Comments

@PaulStovell
Copy link
Member

Adding a new console app and installing Octopus.Client and running results in an exception - the JSON.NET that we compile against is older than the one NuGet installs. We probably need to put a binding redirect in or something.

@nblumhardt
Copy link
Contributor

NuGet should already add the binding redirect when Octopus.Client is installed, but binary incompatibility between JSON.NET versions will still affect us unless we specify a version range.

Is the error something like MissingMethodException?

@PaulStovell
Copy link
Member Author

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3
0ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT
: 0x80131040)
   at Octopus.Client.OctopusClient..ctor(OctopusServerEndpoint serverEndpoint)
   at Octopus.Client.OctopusRepository..ctor(OctopusServerEndpoint endpoint) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Client\Oct
opusRepository.cs:line 52
   at VariableImporter.Program.Main(String[] args) in c:\Users\Paul\Documents\Visual Studio 2013\Projects\VariableImporter\VariableImporter\Program.cs
:line 16

@PaulStovell
Copy link
Member Author

In case anyone comes across this via a search, the workaround is to add a binding redirect like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Where newVersion=6.0.0.0 should be replaced with whatever version of Json.NET that you are referencing.

@PaulStovell
Copy link
Member Author

Going to close this as I don't think it's a good idea for us to be adding binding redirects when apps might already use other versions of Json.NET.

@nblumhardt nblumhardt removed the bug label Feb 10, 2014
@nblumhardt nblumhardt removed this from the 2.1 milestone Feb 10, 2014
@nblumhardt
Copy link
Contributor

Commit above is unrelated to this - typo.

@lock
Copy link

lock bot commented Nov 28, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. If you think you've found a related issue, please contact our support team so we can triage your issue, and make sure it's handled appropriately.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants