dotnet-installer/src/Microsoft.DotNet.Cli.Utils/RuntimeConfigFramework.cs
Piotr Puszkiewicz 6fcbefa4f7 [WIP] Removes *3 verbs, making msbuild the driver (#4456)
Removes *3 verbs, making msbuild the driver
2016-10-27 18:46:43 -07:00

34 lines
1.1 KiB
C#

// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Linq;
using Newtonsoft.Json.Linq;
namespace Microsoft.DotNet.Cli.Utils
{
public class RuntimeConfigFramework
{
public string Name { get; set; }
public string Version { get; set; }
public static RuntimeConfigFramework ParseFromFrameworkRoot(JObject framework)
{
var properties = framework.Properties();
var name = properties.FirstOrDefault(p => p.Name.Equals("name", StringComparison.OrdinalIgnoreCase));
var version = properties.FirstOrDefault(p => p.Name.Equals("version", StringComparison.OrdinalIgnoreCase));
if (name == null || version == null)
{
return null;
}
return new RuntimeConfigFramework
{
Name = name.Value.ToString(),
Version = version.Value.ToString()
};
}
}
}