Trying to make a serializable class in ASP.NET vNext Class Library Project. Not able to give my class items [DataContract] or [DataMember] Attributes. As I just started exploring vNext so I am little confused. If some one can guide me whether I am doing the right thing or not. My little sample code.
using System;
using System.Runtime.Serialization;
namespace Schlouds.Business.Entities
{
[DataContract]
public class Student
{
[DataMember]
public Guid StudentId { get; set; }
}
}
It seems you have to add "System.Runtime.Serialization" to the "frameworkAssemblies".
See example project.json file:
"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"
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With