Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/Artifacts.UnitTests/ArtifactsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ProjectItem> _)
.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);
}
}
}
2 changes: 1 addition & 1 deletion src/Artifacts/Tasks/RobocopyMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static bool TryParse(ITaskItem item, TaskLoggingHelper log, Func<string,
}
catch (Exception e)
{
log.LogError("Failed to expand the path \"{0}\".", item.ItemSpec);
log.LogError("Failed to expand the path \"{0}\".", destination);
log.LogErrorFromException(e);

return false;
Expand Down