gpt4 book ai didi

ASP.NET VNext 类库 System.Runtime.Serialization

转载 作者:行者123 更新时间:2023-12-04 13:59:47 25 4
gpt4 key购买 nike

试图在 ASP.NET vNext 类库项目中创建一个可序列化的类。无法为我的类项提供 [DataContract] 或 [DataMember] 属性。因为我刚刚开始探索 vNext,所以我有点困惑。如果有人可以指导我是否做对了。我的小示例代码。

using System;
using System.Runtime.Serialization;

namespace Schlouds.Business.Entities
{
[DataContract]
public class Student
{
[DataMember]
public Guid StudentId { get; set; }

}
}

最佳答案

看来您必须将“ System.Runtime.Serialization ”添加到“ frameworkAssemblies ”。请参阅示例 project.json 文件:

"net45": {
"frameworkAssemblies": {
"System.Runtime.Serialization": "4.0.0.0"
},
"dependencies": {
"System.Reflection": "4.0.10-beta-22416",
"System.Reflection.Extensions": "4.0.0-beta-22526",
"System.Reflection.Primitives": "4.0.0-beta-22526",
"System.Reflection.TypeExtensions": "4.0.0-beta-22526",
"System.Collections": "4.0.10-beta-22526",
"System.Collections.Specialized": "4.0.0-beta-22526",
"System.Linq": "4.0.0-beta-22526",
"System.Linq.Expressions": "4.0.0-beta-22526",
"System.Linq.Queryable": "4.0.0-beta-22526",
"System.Runtime": "4.0.20-beta-22526",
"System.Runtime.Serialization.Primitives": "4.0.0-beta-22526",
"System.Runtime.Serialization.Xml": "4.0.10-beta-22526",
"System.Runtime.Serialization.Json": "4.0.0.0-beta-22526"
}
}

关于ASP.NET VNext 类库 System.Runtime.Serialization,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28153809/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com