From fa1b4fc56647d7d72cff6d739539c0c491d7436a Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Tue, 23 Oct 2018 12:00:50 +0300 Subject: [PATCH] Got rid of warning CS0618: 'Deserializer.Deserializer on Build --- src/GitVersionCore/Configuration/ConfigSerialiser.cs | 8 ++++---- src/GitVersionCore/Configuration/LegacyConfigNotifier.cs | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/GitVersionCore/Configuration/ConfigSerialiser.cs b/src/GitVersionCore/Configuration/ConfigSerialiser.cs index a67c0e30a3..271922d36d 100644 --- a/src/GitVersionCore/Configuration/ConfigSerialiser.cs +++ b/src/GitVersionCore/Configuration/ConfigSerialiser.cs @@ -1,4 +1,4 @@ -namespace GitVersion +namespace GitVersion { using System.IO; using YamlDotNet.Serialization; @@ -8,7 +8,7 @@ public class ConfigSerialiser { public static Config Read(TextReader reader) { - var deserializer = new Deserializer(null, new HyphenatedNamingConvention()); + var deserializer = new DeserializerBuilder().WithNamingConvention(new HyphenatedNamingConvention()).Build(); var deserialize = deserializer.Deserialize(reader); if (deserialize == null) { @@ -19,8 +19,8 @@ public static Config Read(TextReader reader) public static void Write(Config config, TextWriter writer) { - var serializer = new Serializer(SerializationOptions.None, new HyphenatedNamingConvention()); + var serializer = new SerializerBuilder().WithNamingConvention(new HyphenatedNamingConvention()).Build(); serializer.Serialize(writer, config); } } -} \ No newline at end of file +} diff --git a/src/GitVersionCore/Configuration/LegacyConfigNotifier.cs b/src/GitVersionCore/Configuration/LegacyConfigNotifier.cs index e591b9f263..2086255579 100644 --- a/src/GitVersionCore/Configuration/LegacyConfigNotifier.cs +++ b/src/GitVersionCore/Configuration/LegacyConfigNotifier.cs @@ -25,7 +25,8 @@ public class LegacyConfigNotifier public static void Notify(StringReader reader) { - var deserializer = new Deserializer(null, new NullNamingConvention(), ignoreUnmatched: true); + var deserializer = new DeserializerBuilder().WithNamingConvention(new NullNamingConvention()).IgnoreUnmatchedProperties().Build(); + var legacyConfig = deserializer.Deserialize(reader); if (legacyConfig == null) return; @@ -59,4 +60,4 @@ public static void Notify(StringReader reader) throw new OldConfigurationException("GitVersion configuration file contains old configuration, please fix the following errors:\r\n" + string.Join("\r\n", issues)); } } -} \ No newline at end of file +}