0

I am trying to executing Entity Framework migrations from VSTS Release Management, for that I followed this link.

I configure this task in this way, before the deploying task for the application:

enter image description here

During release process I got the Exception, after executing the above task.

System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

In my Project I used the Newtonsoft.Json version as 9.0.1 because other DLL’s dependent on this version. So I strict to use the same version of Newtonsoft.Json.

app.config

       <dependentAssembly>

          <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />

          <bindingRedirect oldVersion="0.0.0.0-9.0.1" newVersion="9.0.1" />

      </dependentAssembly>

Before posting question here I search in Google and find out some the links related my issue but those are not helpful to resolve this issue.

Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'

I found similar issue in stack overflow but nobody can't post answer for that. This is the link for that question migrate.exe ignoring binding redirects

Can you please tell me how to resolve the above error as soon as possible?

Pradeep
  • 5,101
  • 14
  • 68
  • 140
  • Could you add your packages.config and `` section from your web/app.config? – phuzi Jun 13 '17 at 10:47
  • I can't reproduce this issue, what's the result if you try it with a new project? I shared a simple project on the OneDrive, you can try again with it and check the result. https://1drv.ms/u/s!AresBGZVYryjhSz-Mo-ZCrXBEGEJ – starian chen-MSFT Jun 14 '17 at 07:36
  • Thanks @starain-MSFT, I am not getting the issue in my local machine. the issue occurred during VSTS release management. – Pradeep Jun 14 '17 at 07:40
  • Both of these ways work fine for me. Try it with my project and check the result. – starian chen-MSFT Jun 14 '17 at 07:48
  • If it doesn't work, share the detail log fine on the OneDrive. – starian chen-MSFT Jun 14 '17 at 07:48
  • Thanks @starain-MSFT, I tried with your project but I did not any issues because in your project there is no code related to initialize the azure key vault provider. But in my original project there is a code related to initialize the azure key vault provider. I shared logs on the one drive https://1drv.ms/t/s!At-JUB9_wu9CvTtQeV5XGDPbHHhs – Pradeep Jun 14 '17 at 09:50
  • I find the question in stack overflow similar to my issue. This is link https://stackoverflow.com/questions/43679656/migrate-exe-ignoring-binding-redirects – Pradeep Jun 14 '17 at 09:52
  • I can reproduce this issue, could you configure migration database through publish profile? (Right click project > Publish > Check Execute Code First Migrations option in settings section) – starian chen-MSFT Jun 15 '17 at 02:18

1 Answers1

0

I would guess that you have something like

<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>

In your app/web.config

You will need to make sure that you change the 6 to a 9 so that your app looks for the correct/installed version, e.g.

<dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json"  publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
    <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/>
</dependentAssembly>
phuzi
  • 12,078
  • 3
  • 26
  • 50