Windows 10上的ASP.NET Core:找不到System.Runtime.Serialization.Xml 4.0.0.0

时间:2017-03-02 18:31:22

标签: c# asp.net .net-core

我有一个.NET Core MVC应用程序,具有以下project.json依赖项和工具:

"dependencies": {
"Microsoft.NETCore.App": {
  "version": "1.1.0",
  "type": "platform"
},
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Routing": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.1",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.Design": "1.1.0",
"System.Runtime.Serialization.Json" : "4.0.0",
"System.Runtime.Serialization.Xml" : "4.0.0",
"SpinWorks.JobManager.SpecificModels": {
  "version": "1.0.0",
  "target": "project"
  }
 },

"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final"
 },

请注意,我故意添加了以下内容:

"System.Runtime.Serialization.Json" : "4.0.0",
"System.Runtime.Serialization.Xml" : "4.0.0",

这是我在运行时得到的错误:

fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]
  An unhandled exception has occurred: Could not load file or assembly 'System.Runtime.Serialization.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.Serialization.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

1 个答案:

答案 0 :(得分:3)

更改版本如下。它应该工作。

Mag_time