Bring Host build into separate project
This commit is contained in:
parent
07b785c183
commit
7bf08c5bd5
76 changed files with 1065 additions and 320 deletions
28
build_projects/shared-build-targets-utils/Utils/JsonUtils.cs
Normal file
28
build_projects/shared-build-targets-utils/Utils/JsonUtils.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public static class JsonUtils
|
||||
{
|
||||
public static JObject ReadProject(string projectJsonPath)
|
||||
{
|
||||
using (TextReader projectFileReader = File.OpenText(projectJsonPath))
|
||||
{
|
||||
var projectJsonReader = new JsonTextReader(projectFileReader);
|
||||
|
||||
var serializer = new JsonSerializer();
|
||||
return serializer.Deserialize<JObject>(projectJsonReader);
|
||||
}
|
||||
}
|
||||
|
||||
public static void WriteProject(JObject projectRoot, string projectJsonPath)
|
||||
{
|
||||
string projectJson = JsonConvert.SerializeObject(projectRoot, Formatting.Indented);
|
||||
|
||||
File.WriteAllText(projectJsonPath, projectJson + Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue