forked from dotnet/msbuild
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssemblyFolderCollection.cs
More file actions
35 lines (30 loc) · 1.31 KB
/
Copy pathAssemblyFolderCollection.cs
File metadata and controls
35 lines (30 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using System.Xml;
#nullable disable
namespace Microsoft.Build.Framework
{
[DataContract(Name = "AssemblyFoldersConfig", Namespace = "")]
internal class AssemblyFolderCollection
{
[DataMember]
internal List<AssemblyFolderItem> AssemblyFolders { get; set; }
/// <summary>
/// Deserialize the file into an AssemblyFolderCollection.
/// </summary>
/// <param name="filePath">Path to the AssemblyFolder.config file.</param>
/// <returns>New deserialized collection instance.</returns>
internal static AssemblyFolderCollection Load(string filePath)
{
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
using (XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(fs, new XmlDictionaryReaderQuotas()))
{
DataContractSerializer serializer = new DataContractSerializer(typeof(AssemblyFolderCollection));
return (AssemblyFolderCollection)serializer.ReadObject(reader, true);
}
}
}
}