我无法在DNX Core 5.0中找到[Serializable] 我尝试使用System'。它适用于DNX 4.5.1但不适用于5.0 我应该添加哪些软件包才能使其正常工作?
[Serializable]
public class WorkItem
{
}
我的项目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"
]
}
答案 0 :(得分:1)
我遇到了同样的问题,并尝试了DataContract属性,它对我有用。