Reputation: 2065
I get the following error, but ONLY in the production environment. Locally in the development environment, the application runs without issue.
Nowhere in my app am I referencing Json Version 6.0.0
UPDATE: I can reproduce this error locally by PUBLISHING (VS2015) to local drive, and running approot/web.cmd locally. So maybe the issue is in the publish.
Question: How can I resolve this issue?
System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified. File name: 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream) at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load() at Microsoft.Extensions.Configuration.ConfigurationBuilder.Add(IConfigurationProvider provider) at Microsoft.Extensions.Configuration.JsonConfigurationExtensions.AddJsonFile(IConfigurationBuilder configurationBuilder, String path, Boolean optional) at Microsoft.AspNet.Hosting.WebApplication.Run(Type startupType, String[] args) at Microsoft.AspNet.Server.Kestrel.Program.Main(String[] args) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider) at Microsoft.Dnx.ApplicationHost.Program.<>c__DisplayClass3_0.b__0() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.Execute()=== Pre-bind state information === LOG: DisplayName = Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed (Fully-specified) LOG: Appbase = file:///C:/inetpub/_ALPHA/approot/runtimes/dnx-clr-win-x86.1.0.0-rc1-update1/bin/ LOG: Initial PrivatePath = NULL Calling assembly : (Unknown). === LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed LOG: Fusion is hosted. Check host about this assembly. LOG: Try host assembly store with assembly newtonsoft.json, version=6.0.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed, processorarchitecture=x86. LOG: Try host assembly store with assembly newtonsoft.json, version=6.0.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed, processorarchitecture=msil. LOG: Try host assembly store with assembly newtonsoft.json, version=6.0.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed. WRN: Host assembly store does not contain this assembly. LOG: Attempting download of new URL file:///C:/inetpub/_ALPHA/approot/runtimes/dnx-clr-win-x86.1.0.0-rc1-update1/bin/Newtonsoft.Json.DLL. LOG: Attempting download of new URL file:///C:/inetpub/_ALPHA/approot/runtimes/dnx-clr-win-x86.1.0.0-rc1-update1/bin/Newtonsoft.Json/Newtonsoft.Json.DLL. LOG: Attempting download of new URL file:///C:/inetpub/_ALPHA/approot/runtimes/dnx-clr-win-x86.1.0.0-rc1-update1/bin/Newtonsoft.Json.EXE. LOG: Attempting download of new URL file:///C:/inetpub/_ALPHA/approot/runtimes/dnx-clr-win-x86.1.0.0-rc1-update1/bin/Newtonsoft.Json/Newtonsoft.Json.EXE.
Upvotes: 0
Views: 598
Reputation: 49779
New Newtonsoft.Json 9.0.1 has been released with ASP.NET Core support.
Upvotes: 0
Reputation: 2065
Update: I think this is related to a bug described here (https://github.com/aspnet/Tooling/issues/45) which has to do with the order in which projects are created inside the solution. In this case, I started with a .NET 4.5.1 class library, then added the ASP.NET Core 1.0 WebAPI project. For some reason, whenever I added my class library, Json.NET would get added to the project, but with a version number of 1.0.
My solution was to start the solution over form scratch. This time I started with the WebAPI project, then added in the class library, then referenced the class library within the WebAPI project, and it now shows Json.NET 8.0.2.
I hope Microsoft gets this bug fixed, as you should be able to added a ASP.NET Core app to an existing solution without any issues, unfortunately this is not currently the case,
Upvotes: -1