我无法在DNX Core 5.0中找到[Serializable]

本文关键字:Serializable DNX Core | 更新日期: 2023-09-27 18:18:32

我在DNX Core 5.0中找不到[Serializable我尝试用"使用系统"。它适用于DNX 4.5.1,但不适用于5.0我应该添加什么包来完成这个工作?

        [Serializable]
        public class WorkItem
        {
        }

My Project json

{
  "webroot": "wwwroot",
  "version": "1.0.0-*",
  "dependencies": {
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta7",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-beta7",
    "_my.DataAccess.Common": "1.0.0-*",
    "_my.DependencyInjection.Common": "1.0.0-*",
    "System.Runtime.Serialization": "4.0.0.0"
  },
  "commands": {
    "web": "Microsoft.AspNet.Hosting --config hosting.ini"
  },
  "frameworks": {
    "dnx451": {
      "frameworkAssemblies": {
        "System.Runtime.Serialization": "4.0.0.0"
      }
    },
    "dnxcore50": { }
  },
  "publishExclude": [
    "node_modules",
    "bower_components",
    "**.xproj",
    "**.user",
    "**.vspscc"
  ],
  "exclude": [
    "wwwroot",
    "node_modules",
    "bower_components"
  ]
}

我无法在DNX Core 5.0中找到[Serializable]

我得到了同样的问题,并尝试了DataContract属性,它为我工作。