Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET VNext Class Library System.Runtime.Serialization

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; }

    }
}
like image 877
Ali Avatar asked Jan 26 '15 16:01

Ali


1 Answers

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"
        }
    }
like image 78
Stef Heyenrath Avatar answered Sep 28 '22 04:09

Stef Heyenrath