dotnet-installer/test/dotnet-add-p2p.Tests/ProjDir.cs
Krzysztof Wicher b8b7d98256 last touches
2016-11-22 14:46:33 -08:00

34 lines
No EOL
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.IO;
using Microsoft.Build.Construction;
using Microsoft.Build.Evaluation;
namespace Microsoft.DotNet.Cli.Add.P2P.Tests
{
internal 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());
}
}
}