2016-08-16 10 views
1

私は自分のプロジェクトとは別のDLLにすべてのビジネスロジックを持つWebフォームアプリケーションを持っています。 dllには、Newtonsoft.jsonという2つの異なるバージョンが必要です。私はウェブサイトweb.configとdll app.configファイルの両方で以下のコードを使用しようとしましたが、指定したフォルダからDLLをロードするアプリケーションを取得できません。 "Newtonsoft.Json、Version = 4.5.0.0、Culture = neutral、PublicKeyToken = 30ad4fe6b2a6aeed"またはその依存関係の1つをロードできませんでした。配置されたアセンブリのマニフェスト定義がアセンブリ参照と一致しません。 (HRESULTからの例外:0x80131040) "2つの独立したバージョンのDLLを持っています

私が間違っているかもしれないことに関するアイデアはありますか?

<runtime> 
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
    <dependentAssembly> 
    <!--<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> 
    <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />--> 

    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken ="30ad4fe6b2a6aeed" culture="neutral" /> 
    <bindingRedirect oldVersion="4.5.0.0" newVersion="5.0.1.0" /> 
    <bindingRedirect oldVersion="5.0.2.0-99.0.0.0" newVersion="7.0.1.0" /> 
    <codeBase version="4.5.0.0" href="Bin/Newtonsoft.Json/5.0.1.0/Newtonsoft.Json.dll" /> 
    <codeBase version="5.0.1.0" href="Bin/Newtonsoft.Json/5.0.1.0/Newtonsoft.Json.dll" /> 
    <codeBase version="7.0.1.0" href="Bin/Newtonsoft.Json/7.0.1.18622/Newtonsoft.Json.dll" /> 

    <!--<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> 
    <bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="7.0.1.0" />--> 

    </dependentAssembly> 
</assemblyBinding> 

を解決しよう:両方のWebConfigに次のように追加して、 <bindingRedirect oldVersion="0.0.0.0-99.0.0.0" newVersion="7.0.1.0" />

+1

のAppConfigのAppConfig。 .. –

+0

私はDropbox.APIとHangfireを使用し、彼らはNewtonsoft.Jsonの異なるバージョンを使用します – user1454695

+0

なぜ2つのバージョンが必要ですか? – Brandon

答えて

1

は、両方のWebConfigに次のように追加して、あなたがこれを行う必要があるだろう、なぜかしら<bindingRedirect oldVersion="0.0.0.0-99.0.0.0" newVersion="7.0.1.0" />

関連する問題