From aea6d38080c40b103a7d0153a9c12abd49a18569 Mon Sep 17 00:00:00 2001
From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com>
Date: Tue, 9 Mar 2021 17:26:47 -0800
Subject: [PATCH 01/12] Allow manually setting TargetPath on items
---
src/Shared/Constants.cs | 4 ++++
src/Tasks/AssignTargetPath.cs | 15 +++++++++++----
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/Shared/Constants.cs b/src/Shared/Constants.cs
index d8b2c66c98d..eea2401dca9 100644
--- a/src/Shared/Constants.cs
+++ b/src/Shared/Constants.cs
@@ -166,6 +166,10 @@ internal static class ItemMetadataNames
internal const string subType = "SubType";
internal const string executableExtension = "ExecutableExtension";
internal const string embedInteropTypes = "EmbedInteropTypes";
+
+ ///
+ /// The output path for a given item.
+ ///
internal const string targetPath = "TargetPath";
internal const string dependentUpon = "DependentUpon";
internal const string msbuildSourceProjectFile = "MSBuildSourceProjectFile";
diff --git a/src/Tasks/AssignTargetPath.cs b/src/Tasks/AssignTargetPath.cs
index ffb085cfcf6..438bcecabd5 100644
--- a/src/Tasks/AssignTargetPath.cs
+++ b/src/Tasks/AssignTargetPath.cs
@@ -71,13 +71,20 @@ public override bool Execute()
for (int i = 0; i < Files.Length; ++i)
{
- string link = Files[i].GetMetadata(ItemMetadataNames.link);
AssignedFiles[i] = new TaskItem(Files[i]);
+ string targetPath = Files[i].GetMetadata(ItemMetadataNames.targetPath);
- // If file has a link, use that.
- string targetPath = link;
+ // If TargetPath is already set, copy it over.
+ // https://github.com/dotnet/msbuild/issues/2795
+ if (!string.IsNullOrEmpty(targetPath))
+ {
+ AssignedFiles[i].SetMetadata(ItemMetadataNames.targetPath, EscapingUtilities.Escape(targetPath));
+ continue;
+ }
+
+ targetPath = Files[i].GetMetadata(ItemMetadataNames.link);
- if (string.IsNullOrEmpty(link))
+ if (string.IsNullOrEmpty(targetPath))
{
if (// if the file path is relative
!Path.IsPathRooted(Files[i].ItemSpec) &&
From 137343218241d2c4b22d47633ad09916716015bc Mon Sep 17 00:00:00 2001
From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com>
Date: Wed, 10 Mar 2021 10:09:24 -0800
Subject: [PATCH 02/12] Add test ensuring TargetPath takes priority if already
set as metadata
---
src/Tasks.UnitTests/AssignTargetPath_Tests.cs | 28 +++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
index 8f159985a94..11fcc500550 100644
--- a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
+++ b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
@@ -5,6 +5,7 @@
using Microsoft.Build.Shared;
using Microsoft.Build.Tasks;
using Microsoft.Build.Utilities;
+using System.Collections.Generic;
using Xunit;
namespace Microsoft.Build.UnitTests
@@ -93,6 +94,33 @@ public void InConeButAbsolute()
NativeMethodsShared.IsWindows ? @"f3\f4\file.txt" : "f3/f4/file.txt",
t.AssignedFiles[0].GetMetadata("TargetPath"));
}
+
+ [Theory]
+ [InlineData("test/output/file.txt")]
+ [InlineData(@"some\dir\to\file.txt")]
+ [InlineData("file.txt")]
+ [InlineData("file")]
+ public void TargetPathAlreadySet(string targetPath)
+ {
+ AssignTargetPath t = new AssignTargetPath();
+ t.BuildEngine = new MockEngine();
+ Dictionary metaData = new Dictionary();
+ metaData.Add("TargetPath", targetPath);
+ t.Files = new ITaskItem[]
+ {
+ new TaskItem(
+ itemSpec: NativeMethodsShared.IsWindows ? @"c:\f1\f2\file.txt" : "/f1/f2/file.txt",
+ itemMetadata: metaData)
+ };
+ t.RootFolder = NativeMethodsShared.IsWindows ? @"c:\f1\f2" : "/f1/f2";
+
+ bool success = t.Execute();
+
+ Assert.True(success);
+
+ Assert.Single(t.AssignedFiles);
+ Assert.Equal(targetPath, t.AssignedFiles[0].GetMetadata("TargetPath"));
+ }
}
}
From 328f0294dfc21af9210705cc7018b8f8362825b7 Mon Sep 17 00:00:00 2001
From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com>
Date: Wed, 10 Mar 2021 10:18:14 -0800
Subject: [PATCH 03/12] Shouldy-fication
---
src/Tasks.UnitTests/AssignTargetPath_Tests.cs | 52 ++++++-------------
1 file changed, 17 insertions(+), 35 deletions(-)
diff --git a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
index 11fcc500550..1b6c9bbb5f5 100644
--- a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
+++ b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
@@ -5,6 +5,7 @@
using Microsoft.Build.Shared;
using Microsoft.Build.Tasks;
using Microsoft.Build.Utilities;
+using Shouldly;
using System.Collections.Generic;
using Xunit;
@@ -21,15 +22,10 @@ public void Regress314791()
{ new TaskItem(NativeMethodsShared.IsWindows ? @"c:\bin2\abc.efg" : "/bin2/abc.efg") };
t.RootFolder = NativeMethodsShared.IsWindows ? @"c:\bin" : "/bin";
- bool success = t.Execute();
-
- Assert.True(success);
-
- Assert.Single(t.AssignedFiles);
- Assert.Equal(
- NativeMethodsShared.IsWindows ? @"c:\bin2\abc.efg" : "/bin2/abc.efg",
- t.AssignedFiles[0].ItemSpec);
- Assert.Equal(@"abc.efg", t.AssignedFiles[0].GetMetadata("TargetPath"));
+ t.Execute().ShouldBeTrue();
+ t.AssignedFiles.Length.ShouldBe(1);
+ t.AssignedFiles[0].ItemSpec.ShouldBe(NativeMethodsShared.IsWindows ? @"c:\bin2\abc.efg" : "/bin2/abc.efg");
+ t.AssignedFiles[0].GetMetadata("TargetPath").ShouldBe("abc.efg");
}
[Fact]
@@ -41,12 +37,9 @@ public void AtConeRoot()
{ new TaskItem(NativeMethodsShared.IsWindows ? @"c:\f1\f2\file.txt" : "/f1/f2/file.txt") };
t.RootFolder = NativeMethodsShared.IsWindows ? @"c:\f1\f2" : "/f1/f2";
- bool success = t.Execute();
-
- Assert.True(success);
-
- Assert.Single(t.AssignedFiles);
- Assert.Equal(@"file.txt", t.AssignedFiles[0].GetMetadata("TargetPath"));
+ t.Execute().ShouldBeTrue();
+ t.AssignedFiles.Length.ShouldBe(1);
+ t.AssignedFiles[0].GetMetadata("TargetPath").ShouldBe("file.txt");
}
[Fact]
@@ -65,12 +58,9 @@ public void OutOfCone()
// /f1 to /x1
t.RootFolder = NativeMethodsShared.IsWindows ? @"c:\f1" : "/x1";
- bool success = t.Execute();
-
- Assert.True(success);
-
- Assert.Single(t.AssignedFiles);
- Assert.Equal("file.txt", t.AssignedFiles[0].GetMetadata("TargetPath"));
+ t.Execute().ShouldBeTrue();
+ t.AssignedFiles.Length.ShouldBe(1);
+ t.AssignedFiles[0].GetMetadata("TargetPath").ShouldBe("file.txt");
}
[Fact]
@@ -85,14 +75,9 @@ public void InConeButAbsolute()
};
t.RootFolder = NativeMethodsShared.IsWindows ? @"c:\f1\f2" : "/f1/f2";
- bool success = t.Execute();
-
- Assert.True(success);
-
- Assert.Single(t.AssignedFiles);
- Assert.Equal(
- NativeMethodsShared.IsWindows ? @"f3\f4\file.txt" : "f3/f4/file.txt",
- t.AssignedFiles[0].GetMetadata("TargetPath"));
+ t.Execute().ShouldBeTrue();
+ t.AssignedFiles.Length.ShouldBe(1);
+ t.AssignedFiles[0].GetMetadata("TargetPath").ShouldBe(NativeMethodsShared.IsWindows ? @"f3\f4\file.txt" : "f3/f4/file.txt");
}
[Theory]
@@ -114,12 +99,9 @@ public void TargetPathAlreadySet(string targetPath)
};
t.RootFolder = NativeMethodsShared.IsWindows ? @"c:\f1\f2" : "/f1/f2";
- bool success = t.Execute();
-
- Assert.True(success);
-
- Assert.Single(t.AssignedFiles);
- Assert.Equal(targetPath, t.AssignedFiles[0].GetMetadata("TargetPath"));
+ t.Execute().ShouldBeTrue();
+ t.AssignedFiles.Length.ShouldBe(1);
+ targetPath.ShouldBe(t.AssignedFiles[0].GetMetadata("TargetPath"));
}
}
}
From 4b3f3eb8c882da43e8399cc62545e43291d4b21c Mon Sep 17 00:00:00 2001
From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com>
Date: Mon, 15 Mar 2021 09:46:53 -0700
Subject: [PATCH 04/12] Rename to targetpathoverride
---
src/Shared/Constants.cs | 5 +++++
src/Tasks.UnitTests/AssignTargetPath_Tests.cs | 6 +++---
src/Tasks/AssignTargetPath.cs | 4 ++--
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/Shared/Constants.cs b/src/Shared/Constants.cs
index eea2401dca9..a0f5302d621 100644
--- a/src/Shared/Constants.cs
+++ b/src/Shared/Constants.cs
@@ -171,6 +171,11 @@ internal static class ItemMetadataNames
/// The output path for a given item.
///
internal const string targetPath = "TargetPath";
+
+ ///
+ /// The user-specified override for TargetPath. See the AssignTargetPath task.
+ ///
+ internal const string targetPathOverride = "TargetPathOverride";
internal const string dependentUpon = "DependentUpon";
internal const string msbuildSourceProjectFile = "MSBuildSourceProjectFile";
internal const string msbuildSourceTargetName = "MSBuildSourceTargetName";
diff --git a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
index 1b6c9bbb5f5..494541d746c 100644
--- a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
+++ b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
@@ -1,12 +1,12 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+using System.Collections.Generic;
using Microsoft.Build.Framework;
using Microsoft.Build.Shared;
using Microsoft.Build.Tasks;
using Microsoft.Build.Utilities;
using Shouldly;
-using System.Collections.Generic;
using Xunit;
namespace Microsoft.Build.UnitTests
@@ -85,12 +85,12 @@ public void InConeButAbsolute()
[InlineData(@"some\dir\to\file.txt")]
[InlineData("file.txt")]
[InlineData("file")]
- public void TargetPathAlreadySet(string targetPath)
+ public void TargetPathOverrideSet(string targetPath)
{
AssignTargetPath t = new AssignTargetPath();
t.BuildEngine = new MockEngine();
Dictionary metaData = new Dictionary();
- metaData.Add("TargetPath", targetPath);
+ metaData.Add("TargetPathOverride", targetPath);
t.Files = new ITaskItem[]
{
new TaskItem(
diff --git a/src/Tasks/AssignTargetPath.cs b/src/Tasks/AssignTargetPath.cs
index 438bcecabd5..05fdb020778 100644
--- a/src/Tasks/AssignTargetPath.cs
+++ b/src/Tasks/AssignTargetPath.cs
@@ -72,9 +72,9 @@ public override bool Execute()
for (int i = 0; i < Files.Length; ++i)
{
AssignedFiles[i] = new TaskItem(Files[i]);
- string targetPath = Files[i].GetMetadata(ItemMetadataNames.targetPath);
+ string targetPath = Files[i].GetMetadata(ItemMetadataNames.targetPathOverride);
- // If TargetPath is already set, copy it over.
+ // TargetPathOverride takes priority.
// https://github.com/dotnet/msbuild/issues/2795
if (!string.IsNullOrEmpty(targetPath))
{
From d795b4e3a179cbfa17084834fde472e0f4d46a06 Mon Sep 17 00:00:00 2001
From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com>
Date: Mon, 15 Mar 2021 15:10:15 -0700
Subject: [PATCH 05/12] If targetpathoverride is not set fall back to link.
Avoid duplicated code
---
src/Tasks/AssignTargetPath.cs | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/Tasks/AssignTargetPath.cs b/src/Tasks/AssignTargetPath.cs
index 05fdb020778..a4cffdc434b 100644
--- a/src/Tasks/AssignTargetPath.cs
+++ b/src/Tasks/AssignTargetPath.cs
@@ -72,18 +72,17 @@ public override bool Execute()
for (int i = 0; i < Files.Length; ++i)
{
AssignedFiles[i] = new TaskItem(Files[i]);
- string targetPath = Files[i].GetMetadata(ItemMetadataNames.targetPathOverride);
// TargetPathOverride takes priority.
// https://github.com/dotnet/msbuild/issues/2795
- if (!string.IsNullOrEmpty(targetPath))
+ string targetPath = Files[i].GetMetadata(ItemMetadataNames.targetPathOverride);
+
+ // If TargetPathOverride not set, fall back to default behavior.
+ if (string.IsNullOrEmpty(targetPath))
{
- AssignedFiles[i].SetMetadata(ItemMetadataNames.targetPath, EscapingUtilities.Escape(targetPath));
- continue;
+ targetPath = Files[i].GetMetadata(ItemMetadataNames.link);
}
- targetPath = Files[i].GetMetadata(ItemMetadataNames.link);
-
if (string.IsNullOrEmpty(targetPath))
{
if (// if the file path is relative
From a6c32457d1995a777d002a8b62655150769ec8bf Mon Sep 17 00:00:00 2001
From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com>
Date: Mon, 15 Mar 2021 15:14:00 -0700
Subject: [PATCH 06/12] Add fully qualified path as test case
---
src/Tasks.UnitTests/AssignTargetPath_Tests.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
index 494541d746c..7ec074875ee 100644
--- a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
+++ b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
@@ -81,6 +81,7 @@ public void InConeButAbsolute()
}
[Theory]
+ [InlineData("c:/fully/qualified/path.txt")]
[InlineData("test/output/file.txt")]
[InlineData(@"some\dir\to\file.txt")]
[InlineData("file.txt")]
From 8bc9c3b89cc994d16e84ccd192142839782be682 Mon Sep 17 00:00:00 2001
From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com>
Date: Wed, 31 Mar 2021 09:36:22 -0700
Subject: [PATCH 07/12] Use TargetPath instead of TargetPathOverride. Placed
under a 16.10 changewave
---
src/Shared/Constants.cs | 5 ---
src/Tasks.UnitTests/AssignTargetPath_Tests.cs | 34 +++++++++++++++++--
src/Tasks/AssignTargetPath.cs | 6 ++--
3 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/src/Shared/Constants.cs b/src/Shared/Constants.cs
index a0f5302d621..eea2401dca9 100644
--- a/src/Shared/Constants.cs
+++ b/src/Shared/Constants.cs
@@ -171,11 +171,6 @@ internal static class ItemMetadataNames
/// The output path for a given item.
///
internal const string targetPath = "TargetPath";
-
- ///
- /// The user-specified override for TargetPath. See the AssignTargetPath task.
- ///
- internal const string targetPathOverride = "TargetPathOverride";
internal const string dependentUpon = "DependentUpon";
internal const string msbuildSourceProjectFile = "MSBuildSourceProjectFile";
internal const string msbuildSourceTargetName = "MSBuildSourceTargetName";
diff --git a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
index 7ec074875ee..a2b3f6604cf 100644
--- a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
+++ b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
@@ -86,12 +86,13 @@ public void InConeButAbsolute()
[InlineData(@"some\dir\to\file.txt")]
[InlineData("file.txt")]
[InlineData("file")]
- public void TargetPathOverrideSet(string targetPath)
+ public void TargetPathAlreadySet(string targetPath)
{
AssignTargetPath t = new AssignTargetPath();
t.BuildEngine = new MockEngine();
Dictionary metaData = new Dictionary();
- metaData.Add("TargetPathOverride", targetPath);
+ metaData.Add("TargetPath", targetPath);
+ metaData.Add("Link", "c:/foo/bar");
t.Files = new ITaskItem[]
{
new TaskItem(
@@ -104,6 +105,35 @@ public void TargetPathOverrideSet(string targetPath)
t.AssignedFiles.Length.ShouldBe(1);
targetPath.ShouldBe(t.AssignedFiles[0].GetMetadata("TargetPath"));
}
+
+ [Theory]
+ [InlineData("c:/fully/qualified/path.txt")]
+ [InlineData("test/output/file.txt")]
+ [InlineData(@"some\dir\to\file.txt")]
+ [InlineData("file.txt")]
+ [InlineData("file")]
+ public void TargetPathAlreadySet_DisabledUnderChangeWave16_10(string targetPath)
+ {
+ using TestEnvironment env = TestEnvironment.Create();
+ string link = "c:/some/path";
+ env.SetEnvironmentVariable("MSBuildDisableFeaturesFromVersion", "16.10");
+ AssignTargetPath t = new AssignTargetPath();
+ t.BuildEngine = new MockEngine();
+ Dictionary metaData = new Dictionary();
+ metaData.Add("TargetPath", targetPath);
+ metaData.Add("Link", link);
+ t.Files = new ITaskItem[]
+ {
+ new TaskItem(
+ itemSpec: NativeMethodsShared.IsWindows ? @"c:\f1\f2\file.txt" : "/f1/f2/file.txt",
+ itemMetadata: metaData)
+ };
+ t.RootFolder = NativeMethodsShared.IsWindows ? @"c:\f1\f2" : "/f1/f2";
+
+ t.Execute().ShouldBeTrue();
+ t.AssignedFiles.Length.ShouldBe(1);
+ link.ShouldBe(t.AssignedFiles[0].GetMetadata("TargetPath"));
+ }
}
}
diff --git a/src/Tasks/AssignTargetPath.cs b/src/Tasks/AssignTargetPath.cs
index a4cffdc434b..6b033ae1fb0 100644
--- a/src/Tasks/AssignTargetPath.cs
+++ b/src/Tasks/AssignTargetPath.cs
@@ -73,11 +73,11 @@ public override bool Execute()
{
AssignedFiles[i] = new TaskItem(Files[i]);
- // TargetPathOverride takes priority.
+ // If TargetPath is already set, it takes priority.
// https://github.com/dotnet/msbuild/issues/2795
- string targetPath = Files[i].GetMetadata(ItemMetadataNames.targetPathOverride);
+ string targetPath = ChangeWaves.AreFeaturesEnabled(ChangeWaves.Wave16_10) ? Files[i].GetMetadata(ItemMetadataNames.targetPath) : null;
- // If TargetPathOverride not set, fall back to default behavior.
+ // If TargetPath not already set, fall back to default behavior.
if (string.IsNullOrEmpty(targetPath))
{
targetPath = Files[i].GetMetadata(ItemMetadataNames.link);
From 266ca4d4d103175666669360f11b4ff98915b478 Mon Sep 17 00:00:00 2001
From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com>
Date: Wed, 31 Mar 2021 09:39:23 -0700
Subject: [PATCH 08/12] Add link to PR in change waves doc.
---
documentation/wiki/ChangeWaves.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/documentation/wiki/ChangeWaves.md b/documentation/wiki/ChangeWaves.md
index 46d1d61b4e5..dc6273622ff 100644
--- a/documentation/wiki/ChangeWaves.md
+++ b/documentation/wiki/ChangeWaves.md
@@ -25,6 +25,7 @@ The opt-out comes in the form of setting the environment variable `MSBuildDisabl
- [Don't expand full drive globs with false condition](https://github.com/dotnet/msbuild/pull/5669)
### 16.10
- [Error when a property expansion in a condition has whitespace](https://github.com/dotnet/msbuild/pull/5672)
+- [Allow Custom CopyToOutputDirectory Location With TargetPath](https://github.com/dotnet/msbuild/pull/6237)
### 17.0
## Change Waves No Longer In Rotation
From 4941a4cabd04685bb4aad5498f639dca3ec6c5aa Mon Sep 17 00:00:00 2001
From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com>
Date: Wed, 31 Mar 2021 10:29:24 -0700
Subject: [PATCH 09/12] Reset change waves between tests
---
src/Tasks.UnitTests/AssignTargetPath_Tests.cs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
index a2b3f6604cf..70768d327e3 100644
--- a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
+++ b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
@@ -116,7 +116,11 @@ public void TargetPathAlreadySet_DisabledUnderChangeWave16_10(string targetPath)
{
using TestEnvironment env = TestEnvironment.Create();
string link = "c:/some/path";
- env.SetEnvironmentVariable("MSBuildDisableFeaturesFromVersion", "16.10");
+
+ ChangeWaves.ResetStateForTests();
+ env.SetEnvironmentVariable("MSBuildDisableFeaturesFromVersion", ChangeWaves.Wave16_10.ToString());
+ BuildEnvironmentHelper.ResetInstance_ForUnitTestsOnly();
+
AssignTargetPath t = new AssignTargetPath();
t.BuildEngine = new MockEngine();
Dictionary metaData = new Dictionary();
From 12abb9624e6d9f835fb764100633ced983cd7848 Mon Sep 17 00:00:00 2001
From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com>
Date: Wed, 31 Mar 2021 10:42:58 -0700
Subject: [PATCH 10/12] Test: Reset state before and after tests
---
src/Tasks.UnitTests/AssignTargetPath_Tests.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
index 70768d327e3..3fe0b288d43 100644
--- a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
+++ b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
@@ -137,6 +137,7 @@ public void TargetPathAlreadySet_DisabledUnderChangeWave16_10(string targetPath)
t.Execute().ShouldBeTrue();
t.AssignedFiles.Length.ShouldBe(1);
link.ShouldBe(t.AssignedFiles[0].GetMetadata("TargetPath"));
+ ChangeWaves.ResetStateForTests();
}
}
}
From c874990c9a95f4b0afbd370e06b36cc7aeddc5af Mon Sep 17 00:00:00 2001
From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com>
Date: Wed, 31 Mar 2021 11:16:46 -0700
Subject: [PATCH 11/12] unix environment variables are case sensitive..
---
src/Tasks.UnitTests/AssignTargetPath_Tests.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
index 3fe0b288d43..1129006c05f 100644
--- a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
+++ b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
@@ -118,7 +118,7 @@ public void TargetPathAlreadySet_DisabledUnderChangeWave16_10(string targetPath)
string link = "c:/some/path";
ChangeWaves.ResetStateForTests();
- env.SetEnvironmentVariable("MSBuildDisableFeaturesFromVersion", ChangeWaves.Wave16_10.ToString());
+ env.SetEnvironmentVariable("MSBUILDDISABLEFEATURESFROMVERSION", ChangeWaves.Wave16_10.ToString());
BuildEnvironmentHelper.ResetInstance_ForUnitTestsOnly();
AssignTargetPath t = new AssignTargetPath();
From 663295da7296116463ff6c459494b698b3dd2bd7 Mon Sep 17 00:00:00 2001
From: Ben Villalobos <4691428+BenVillalobos@users.noreply.github.com>
Date: Thu, 1 Apr 2021 11:23:40 -0700
Subject: [PATCH 12/12] PR Feedback: Compare variable against what it should
be, not the other way around
---
src/Tasks.UnitTests/AssignTargetPath_Tests.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
index 1129006c05f..3f9dc087274 100644
--- a/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
+++ b/src/Tasks.UnitTests/AssignTargetPath_Tests.cs
@@ -103,7 +103,7 @@ public void TargetPathAlreadySet(string targetPath)
t.Execute().ShouldBeTrue();
t.AssignedFiles.Length.ShouldBe(1);
- targetPath.ShouldBe(t.AssignedFiles[0].GetMetadata("TargetPath"));
+ t.AssignedFiles[0].GetMetadata("TargetPath").ShouldBe(targetPath);
}
[Theory]
@@ -136,7 +136,7 @@ public void TargetPathAlreadySet_DisabledUnderChangeWave16_10(string targetPath)
t.Execute().ShouldBeTrue();
t.AssignedFiles.Length.ShouldBe(1);
- link.ShouldBe(t.AssignedFiles[0].GetMetadata("TargetPath"));
+ t.AssignedFiles[0].GetMetadata("TargetPath").ShouldBe(link);
ChangeWaves.ResetStateForTests();
}
}