After running a clean solution and rebuild, my MVC 4 Web API project stops working. It's can't find Newtonsoft.Json.
I know that MS is using this as the default JSON serializer now - but its not in the references list for the project, and I can't add it from NuGet as it says it's already installed.
Does anyone have any idea here as to what could be going wrong?
Full stack trace:
[FileNotFoundException: 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.]
MvcWebRole1.WebApiApplication.Application_Error() in d:\Data\Source Controlled Projects\georace\georace\Server\GeoRaceServer\MvcWebRole1\Global.asax.cs:70[HttpException (0x80004005): 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.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12838633
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475[HttpException (0x80004005): 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.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12851296 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12679949
Task 1 - Creating the API ProjectRun Visual Studio 2012 Express for Web, to do this go to Start and type VS Express for Web then press Enter. From the File menu, select New Project. Select the Visual C# | Web project type from the project type tree view, then select the ASP.NET MVC 4 Web Application project type.
I would check the version of Newtonsoft. Json in the bin directory of the start up project. If Newtonsoft. Json is there and it is the version you are expecting, then you can use Fuslogvw (https://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx) to see where the loader is trying to get the 4.0.
Obsolete. The value types allowed by the JsonSchema. JSON Schema validation has been moved to its own package. See https://www.newtonsoft.com/jsonschema for more details.
Ok - found a work around myself, posting in case someone else gets caned by this MS bug. The problem is that you can't add a NuGet reference as it's already included in the packages by default. So...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With