diff --git a/tasks.slnf b/tasks.slnf
new file mode 100644
index 000000000000..6039d0ed8a12
--- /dev/null
+++ b/tasks.slnf
@@ -0,0 +1,11 @@
+{
+ "solution": {
+ "path": "sdk.slnx",
+ "projects": [
+ "src\\Tasks\\Microsoft.NET.Build.Tasks\\Microsoft.NET.Build.Tasks.csproj",
+ "src\\Compatibility\\ApiCompat\\Microsoft.DotNet.ApiCompat.Task\\Microsoft.DotNet.ApiCompat.Task.csproj",
+ "src\\Tasks\\Microsoft.NET.Build.Tasks.UnitTests\\Microsoft.NET.Build.Tasks.UnitTests.csproj",
+ "test\\Microsoft.NET.TestFramework\\Microsoft.NET.TestFramework.csproj"
+ ]
+ }
+}
diff --git a/test/Microsoft.NET.TestFramework/Microsoft.NET.TestFramework.csproj b/test/Microsoft.NET.TestFramework/Microsoft.NET.TestFramework.csproj
index 7829d0829246..37c4ddacf2dc 100644
--- a/test/Microsoft.NET.TestFramework/Microsoft.NET.TestFramework.csproj
+++ b/test/Microsoft.NET.TestFramework/Microsoft.NET.TestFramework.csproj
@@ -83,5 +83,8 @@
+
+
+
diff --git a/test/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs b/test/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs
index b2260f81205c..576475008c79 100644
--- a/test/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs
+++ b/test/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs
@@ -87,6 +87,12 @@ public TestProject([CallerMemberName] string? name = null)
///
public List PropertiesToRecord { get; } = new List();
+ ///
+ /// The target before which to record properties specified in .
+ /// Defaults to "AfterBuild".
+ ///
+ public string TargetToRecordPropertiesBefore { get; private set; } = "AfterBuild";
+
public IEnumerable TargetFrameworkIdentifiers
{
get
@@ -252,7 +258,7 @@ internal void Create(TestAsset targetTestAsset, string testProjectsSourceFolder)
if(importGroup?.Attribute("Project") is not null)
{
importGroup.Attribute("Project")!.Value = "$(VSINSTALLDIR)\\MSBuild\\Microsoft\\Portable\\$(TargetFrameworkVersion)\\Microsoft.Portable.CSharp.targets";
- }
+ }
}
if(TargetFrameworkVersion is not null)
@@ -375,12 +381,12 @@ internal void Create(TestAsset targetTestAsset, string testProjectsSourceFolder)
propertyGroup?.Add(new XElement(ns + "CustomAfterDirectoryBuildTargets", $"$(CustomAfterDirectoryBuildTargets);{customAfterDirectoryBuildTargetsPath.FullName}"));
propertyGroup?.Add(new XElement(ns + "CustomAfterMicrosoftCommonCrossTargetingTargets", $"$(CustomAfterMicrosoftCommonCrossTargetingTargets);{customAfterDirectoryBuildTargetsPath.FullName}"));
-
+
var customAfterDirectoryBuildTargets = new XDocument(new XElement(ns + "Project"));
var target = new XElement(ns + "Target",
new XAttribute("Name", "WritePropertyValues"),
- new XAttribute("BeforeTargets", "AfterBuild"));
+ new XAttribute("BeforeTargets", TargetToRecordPropertiesBefore));
customAfterDirectoryBuildTargets.Root?.Add(target);
@@ -491,6 +497,15 @@ public void RecordProperties(params string[] propertyNames)
PropertiesToRecord.AddRange(propertyNames);
}
+ ///
+ /// Tells this TestProject to record properties specified in before the specified target.
+ /// By default properties are recorded before the "AfterBuild" target (so after the actual compile+copy targets have run).
+ ///
+ public void RecordPropertiesBeforeTarget(string targetName)
+ {
+ TargetToRecordPropertiesBefore = targetName;
+ }
+
///
/// A dictionary of property keys to property value strings, case sensitive.
/// Only properties added to the member will be observed.