Skip to content

Commit 764b78c

Browse files
committed
Move property recording .txt to root test location
1 parent b550d16 commit 764b78c

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/Tests/Microsoft.NET.Build.Tests/GlobalPropertyFlowTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ private static void ValidateProperties(TestAsset testAsset, TestProject testProj
260260
expectedRuntimeIdentifier = Path.GetFileName(Directory.GetDirectories(dir).Single());
261261
}
262262

263-
var properties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework: targetFramework, runtimeIdentifier: expectedRuntimeIdentifier);
263+
var properties = testProject.GetPropertyValues(testAsset.TestRoot, testAsset.TestProject.Name);
264264
if (expectSelfContained)
265265
{
266266
properties["SelfContained"].ToLowerInvariant().Should().Be("true");

src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ public class {safeThisName}Class
420420
{propertiesElements}
421421
</ItemGroup>
422422
<WriteLinesToFile
423-
File=`$(IntermediateOutputPath)\PropertyValues.txt`
423+
File=`{targetFolder}\PropertyValues.txt`
424424
Lines=`@(LinesToWrite)`
425425
Overwrite=`true`
426426
Encoding=`Unicode`
@@ -456,17 +456,11 @@ public void RecordProperties(params string[] propertyNames)
456456
PropertiesToRecord.AddRange(propertyNames);
457457
}
458458

459-
public Dictionary<string, string> GetPropertyValues(string testRoot, string configuration = "Debug", string targetFramework = null, string runtimeIdentifier = null)
459+
public Dictionary<string, string> GetPropertyValues(string testRoot, [CallerMemberNameAttribute] string testFolderName = "")
460460
{
461461
var propertyValues = new Dictionary<string, string>();
462462

463-
string intermediateOutputPath = Path.Combine(testRoot, Name, "obj", configuration, targetFramework ?? TargetFrameworks);
464-
if (!string.IsNullOrEmpty(runtimeIdentifier))
465-
{
466-
intermediateOutputPath = Path.Combine(intermediateOutputPath, runtimeIdentifier);
467-
}
468-
469-
foreach (var line in File.ReadAllLines(Path.Combine(intermediateOutputPath, "PropertyValues.txt")))
463+
foreach (var line in File.ReadAllLines(Path.Combine(testRoot, testFolderName, "PropertyValues.txt")))
470464
{
471465
int colonIndex = line.IndexOf(':');
472466
if (colonIndex > 0)

0 commit comments

Comments
 (0)