Skip to content

Commit 438d643

Browse files
committed
Move property values to non rid folder
1 parent 764b78c commit 438d643

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-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, testAsset.TestProject.Name);
263+
var properties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework: targetFramework);
264264
if (expectSelfContained)
265265
{
266266
properties["SelfContained"].ToLowerInvariant().Should().Be("true");

src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public void PublishRuntimeIdentifierSetsRuntimeIdentifierAndDoesOrDoesntOverride
231231
.Pass();
232232

233233
string expectedRid = runtimeIdentifierIsGlobal ? runtimeIdentifier : publishRuntimeIdentifier;
234-
var properties = testProject.GetPropertyValues(testAsset.TestRoot);
234+
var properties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework: tfm);
235235
var finalRid = properties["RuntimeIdentifier"];
236236

237237
Assert.True(finalRid == expectedRid); // This assert is theoretically worthless as the above code will fail if the RID path is wrong.
@@ -260,7 +260,7 @@ public void PublishRuntimeIdentifierOverridesUseCurrentRuntime()
260260
.Should()
261261
.Pass();
262262

263-
var properties = testProject.GetPropertyValues(testAsset.TestRoot);
263+
var properties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework: tfm);
264264
var finalRid = properties["RuntimeIdentifier"];
265265
var ucrRid = properties["NETCoreSdkPortableRuntimeIdentifier"];
266266

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public TestProject([CallerMemberName] string name = null)
5151
public List<TestPackageReference> PackageReferences { get; } = new List<TestPackageReference>();
5252

5353
public List<TestPackageReference> DotNetCliToolReferences { get; } = new List<TestPackageReference>();
54-
54+
5555
public List<CopyFilesTarget> CopyFilesTargets { get; } = new List<CopyFilesTarget>();
5656

5757
public Dictionary<string, string> SourceFiles { get; } = new Dictionary<string, string>();
@@ -60,7 +60,7 @@ public TestProject([CallerMemberName] string name = null)
6060

6161
public Dictionary<string, string> AdditionalProperties { get; } = new Dictionary<string, string>();
6262

63-
public List<KeyValuePair<string, Dictionary<string, string>>> AdditionalItems { get; } = new ();
63+
public List<KeyValuePair<string, Dictionary<string, string>>> AdditionalItems { get; } = new();
6464

6565
public List<Action<XDocument>> ProjectChanges { get; } = new List<Action<XDocument>>();
6666

@@ -299,7 +299,7 @@ internal void Create(TestAsset targetTestAsset, string testProjectsSourceFolder,
299299
new XAttribute("Include", frameworkReference)));
300300
}
301301
}
302-
302+
303303
if (this.CopyFilesTargets.Any())
304304
{
305305
foreach (var copyFilesTarget in CopyFilesTargets)
@@ -420,7 +420,7 @@ public class {safeThisName}Class
420420
{propertiesElements}
421421
</ItemGroup>
422422
<WriteLinesToFile
423-
File=`{targetFolder}\PropertyValues.txt`
423+
File=`$(BaseIntermediateOutputPath)\$(Configuration)\$(TargetFramework)\PropertyValues.txt`
424424
Lines=`@(LinesToWrite)`
425425
Overwrite=`true`
426426
Encoding=`Unicode`
@@ -443,7 +443,7 @@ public class {safeThisName}Class
443443

444444
public void AddItem(string itemName, string attributeName, string attributeValue)
445445
{
446-
AddItem(itemName, new Dictionary<string, string>() { { attributeName, attributeValue } } );
446+
AddItem(itemName, new Dictionary<string, string>() { { attributeName, attributeValue } });
447447
}
448448

449449
public void AddItem(string itemName, Dictionary<string, string> attributes)
@@ -456,11 +456,13 @@ public void RecordProperties(params string[] propertyNames)
456456
PropertiesToRecord.AddRange(propertyNames);
457457
}
458458

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

463-
foreach (var line in File.ReadAllLines(Path.Combine(testRoot, testFolderName, "PropertyValues.txt")))
463+
string intermediateOutputPath = Path.Combine(testRoot, Name, "obj", configuration, targetFramework ?? TargetFrameworks);
464+
465+
foreach (var line in File.ReadAllLines(Path.Combine(intermediateOutputPath, "PropertyValues.txt")))
464466
{
465467
int colonIndex = line.IndexOf(':');
466468
if (colonIndex > 0)

0 commit comments

Comments
 (0)