Prepare test project for dotnet-remove-p2p
This commit is contained in:
parent
78d95b423e
commit
65f699f1cc
12 changed files with 203 additions and 8 deletions
34
test/Msbuild.Tests.Utilities/ProjDir.cs
Normal file
34
test/Msbuild.Tests.Utilities/ProjDir.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
// 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.IO;
|
||||
using Microsoft.Build.Construction;
|
||||
using Microsoft.Build.Evaluation;
|
||||
|
||||
namespace Msbuild.Tests.Utilities
|
||||
{
|
||||
public class ProjDir
|
||||
{
|
||||
public ProjDir(string path)
|
||||
{
|
||||
Path = path;
|
||||
Name = new DirectoryInfo(Path).Name;
|
||||
}
|
||||
|
||||
public string Path { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public string CsProjName => $"{Name}.csproj";
|
||||
public string CsProjPath => System.IO.Path.Combine(Path, CsProjName);
|
||||
|
||||
public string CsProjContent()
|
||||
{
|
||||
return File.ReadAllText(CsProjPath);
|
||||
}
|
||||
|
||||
public ProjectRootElement CsProj()
|
||||
{
|
||||
// Passing new collection to prevent using cached version
|
||||
return ProjectRootElement.Open(CsProjPath, new ProjectCollection());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue