Gigi
Gigi

Reputation: 29441

How do you do XmlIgnore in .NET Core?

Is there any way to prevent properties from being XML-serialized in .NET Core (which we would typically do using the [XmlIgnore] attribute before)?

Upvotes: 2

Views: 738

Answers (2)

Chris Sears
Chris Sears

Reputation: 321

You can add the System.Xml.Serialization package through NuGet.

Right-click Solution -> Manage Packages for Solution

Search for "System.Xml.Serialization" and add it to the projects that need it.

This has allowed me to use [XmlIgnore] attribute with .Net Standard 1.2

enter image description here

Upvotes: 2

MindingData
MindingData

Reputation: 12480

XmlIgnore is not in .net core (Or .net standard 1.6 which is probably more important).

This page here on Github states that .net standard 2.0 will have XmlIgnore included (You can check further by viewing the raw diff between 1.6 and 2.0 here

Upvotes: 2

Related Questions