使用您自己的Newtonsoft.Json版本

时间:2014-07-30 10:10:04

标签: c# build json.net .net-assembly strongname

我使用JsonSchema的一些新功能扩展了Newtonsoft.Json。

问题是我不能将Newtonsoft.Json程序集包含到我的项目中。

当我这样做时,所有内容都会编译,但在运行时它会在尝试加载System.Net.Http.Formatting时崩溃。由于此程序集使用4.5.0.0的Newtonsoft.Json,它会触发重定向,但重定向仅适用于已签名的程序集,而且我没有Newtonsoft.Json的签名密钥。

Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified
=== Pre-bind state information ===
LOG: DisplayName = Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
 (Fully-specified)
LOG: Appbase = file:///C:/work/visualstudio/x/x/
LOG: Initial PrivatePath = C:\work\visualstudio\x\x\bin
Calling assembly : System.Net.Http.Formatting, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\work\visualstudio\x\x\web.config
LOG: Using host configuration file: C:\Users\x\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 4.5.0.0 redirected to 6.0.0.0.
LOG: Post-policy reference: Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
LOG: The same bind was seen before, and was failed with hr = 0x80070002.

我尝试使用Newtonsoft.Json中的“动态”键进行签名,但这与他们签署的那个不同,我只是得到另一个错误,他们不一样。

任何人都有解决方案,或者如何在不重命名的情况下使用此程序集的其他技巧。

0 个答案:

没有答案