diff --git a/src/Artifacts.UnitTests/ArtifactsTests.cs b/src/Artifacts.UnitTests/ArtifactsTests.cs index 5c9405e5..ad44bcbb 100644 --- a/src/Artifacts.UnitTests/ArtifactsTests.cs +++ b/src/Artifacts.UnitTests/ArtifactsTests.cs @@ -279,5 +279,38 @@ public void UsingSdkLogic(bool appendTargetFrameworkToOutputPath) }.Select(i => Path.Combine(artifactsPath.FullName, i)), ignoreOrder: true); } + + [Fact] + public void InvalidDestinationFolderShouldLogAnErrorRegardingDestinationFolder() + { + DirectoryInfo baseOutputPath = CreateFiles( + Path.Combine("bin", "Debug"), + "foo.exe", + "foo.pdb", + "foo.exe.config", + "bar.dll", + "bar.pdb", + "bar.cs"); + + CreateFiles( + Path.Combine(baseOutputPath.FullName, "ref"), + "bar.dll"); + + string artifactPathes = "Foo" + Path.DirectorySeparatorChar + new string(Path.GetInvalidPathChars().Where(i => !char.IsWhiteSpace(i)).ToArray()); + + string outputPath = $"{Path.Combine("bin", "Debug")}{Path.DirectorySeparatorChar}"; + + ProjectCreator.Templates.ProjectWithArtifacts( + outputPath: outputPath, + appendTargetFrameworkToOutputPath: false, + artifactsPath: artifactPathes) + .TryGetItems("Artifact", out IReadOnlyCollection _) + .TryGetPropertyValue("DefaultArtifactsSource", out string _) + .TryBuild(out bool result, out BuildOutput buildOutput); + + string consoleLog = buildOutput.GetConsoleLog(); + result.ShouldBeFalse(consoleLog); + Assert.Contains($"Failed to expand the path \"{artifactPathes}", consoleLog); + } } } \ No newline at end of file diff --git a/src/Artifacts/Tasks/RobocopyMetadata.cs b/src/Artifacts/Tasks/RobocopyMetadata.cs index ef9334e4..61aabdff 100644 --- a/src/Artifacts/Tasks/RobocopyMetadata.cs +++ b/src/Artifacts/Tasks/RobocopyMetadata.cs @@ -113,7 +113,7 @@ public static bool TryParse(ITaskItem item, TaskLoggingHelper log, Func