我在 DNX Core 5.0 中找不到 [Serializable] 我尝试“使用系统”。它适用于 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"
]
}
最佳答案
我遇到了同样的问题并尝试了对我有用的 DataContract 属性。
关于c# - 我在 DNX Core 5.0 中找不到 [Serializable],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33231851/