我刚刚在 Visual Studio 2010 SP1 上安装了 ASP.NET MVC 4.0 RC 版本。我的项目用于编译和使用 ASP.NET MVC 4.0 的测试版,当我访问该站点时出现错误,提示 Newtonsoft.Json 无法找到程序集版本 4.5。
由于我在当前项目中没有使用这个第三方库,我配置了 Fusion Log 来尝试隔离依赖 Newtonsoft.Json 程序集的程序集。
有罪的集会是 System.Net.Http.Formatting.dll 其中引用了 Newtonsoft.Json 4.5 版。
引用版本 System.Json.dll 而不是 Newtonsoft 程序集。
我很难相信微软开始依赖外部程序集,即使他们在开源中发布了越来越多的代码。
有人对发生的事情有解释吗?
最佳答案
他们实际上依赖于第三方软件(就像他们用 JQuery 和knockout.js 提供MVC 一样)。 Scott Guthrie 宣布 MVC 4 将随 JSON.NET (Newtonsoft) 一起提供。见下文:
Json.NET: We plan to use the community developed Json.NET serialization stack in our default JSON formatter in ASP.NET Web API. Json.NET provides the flexibility and performance required for a modern web framework.
http://aspnet.codeplex.com/wikipage?title=ASP.NET%20MVC%204%20RoadMap
你可以保留 System.Json.dll 顺便说一句,我已经得到了它们。如果您对 JSON.NET 有任何问题,只需重新安装它:)
关于asp.net-mvc-4 - ASP.NET MVC 4.0 RC 和 Newsoft.Json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10879236/