Skip to content
4 changes: 4 additions & 0 deletions src/Cli/dotnet/Extensions/OptionForwardingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public static ForwardedOption<string> ForwardAsOutputPath(this ForwardedOption<s
return [];
}
string argVal = CommandDirectoryContext.GetFullPath(o);
if (!Path.EndsInDirectorySeparator(argVal))
{
argVal += Path.DirectorySeparatorChar;
}
if (surroundWithDoubleQuotes)
{
// Not sure if this is necessary, but this is what "dotnet test" previously did and so we are
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public class GivenDotnetBuildInvocation : IClassFixture<NullCurrentSessionIdFixt

[Theory]
[InlineData(new string[] { }, new string[] { })]
[InlineData(new string[] { "-o", "foo" }, new string[] { "-property:OutputPath=<cwd>foo", "-property:_CommandLineDefinedOutputPath=true" })]
[InlineData(new string[] { "-o", "myoutput" }, new string[] { "-property:OutputPath=<cwd>myoutput", "-property:_CommandLineDefinedOutputPath=true" })]
[InlineData(new string[] { "-property:Verbosity=diag" }, new string[] { "--property:Verbosity=diag" })]
[InlineData(new string[] { "--output", "foo" }, new string[] { "-property:OutputPath=<cwd>foo", "-property:_CommandLineDefinedOutputPath=true" })]
[InlineData(new string[] { "--output", "myoutput" }, new string[] { "-property:OutputPath=<cwd>myoutput", "-property:_CommandLineDefinedOutputPath=true" })]
[InlineData(new string[] { "--artifacts-path", "foo" }, new string[] { "-property:ArtifactsPath=<cwd>foo" })]
[InlineData(new string[] { "-o", "foo1 foo2" }, new string[] { "-property:OutputPath=<cwd>foo1 foo2", "-property:_CommandLineDefinedOutputPath=true" })]
[InlineData(new string[] { "-o", "foo1 myoutput" }, new string[] { "-property:OutputPath=<cwd>foo1 myoutput", "-property:_CommandLineDefinedOutputPath=true" })]
[InlineData(new string[] { "--no-incremental" }, new string[] { "-target:Rebuild" })]
[InlineData(new string[] { "-r", "rid" }, new string[] { "-property:RuntimeIdentifier=rid", "-property:_CommandLineDefinedRuntimeIdentifier=true" })]
[InlineData(new string[] { "-r", "linux-amd64" }, new string[] { "-property:RuntimeIdentifier=linux-x64", "-property:_CommandLineDefinedRuntimeIdentifier=true" })]
Expand All @@ -43,7 +43,7 @@ public void MsbuildInvocationIsCorrect(string[] args, string[] expectedAdditiona
{
CommandDirectoryContext.PerformActionWithBasePath(WorkingDirectory, () =>
{
expectedAdditionalArgs = expectedAdditionalArgs.Select(arg => arg.Replace("<cwd>", WorkingDirectory)).ToArray();
expectedAdditionalArgs = expectedAdditionalArgs.Select(arg => arg.Replace("<cwd>", WorkingDirectory).Replace("myoutput", "myoutput" + Path.DirectorySeparatorChar)).ToArray();

var msbuildPath = "<msbuildpath>";
var command = (RestoringCommand)BuildCommand.FromArgs(args, msbuildPath);
Expand Down Expand Up @@ -86,11 +86,11 @@ public void MsbuildInvocationIsCorrectForSeparateRestore(
CommandDirectoryContext.PerformActionWithBasePath(WorkingDirectory, () =>
{
expectedAdditionalArgsForRestore = expectedAdditionalArgsForRestore
.Select(arg => arg.Replace("<cwd>", WorkingDirectory))
.Select(arg => arg.Replace("<cwd>", WorkingDirectory).Replace("myoutput", "myoutput" + Path.DirectorySeparatorChar))
.ToArray();

expectedAdditionalArgs = expectedAdditionalArgs
.Select(arg => arg.Replace("<cwd>", WorkingDirectory))
.Select(arg => arg.Replace("<cwd>", WorkingDirectory).Replace("myoutput", "myoutput" + Path.DirectorySeparatorChar))
.ToArray();

var msbuildPath = "<msbuildpath>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void MsbuildInvocationIsCorrect(string[] args, string[] expectedAdditiona
CommandDirectoryContext.PerformActionWithBasePath(WorkingDirectory, () =>
{
expectedAdditionalArgs = expectedAdditionalArgs
.Select(arg => arg.Replace("<cwd>", WorkingDirectory))
.Select(arg => arg.Replace("<cwd>", WorkingDirectory).Replace("<output>", "<output>" + Path.DirectorySeparatorChar))
.ToArray();

var msbuildPath = "<msbuildpath>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void MsbuildInvocationIsCorrect(string[] args, string[] expectedAdditiona
CommandDirectoryContext.PerformActionWithBasePath(WorkingDirectory, () =>
{
expectedAdditionalArgs = expectedAdditionalArgs
.Select(arg => arg.Replace("<cwd>", WorkingDirectory))
.Select(arg => arg.Replace("<cwd>", WorkingDirectory).Replace("<publishdir>", "<publishdir>" + Path.DirectorySeparatorChar))
.ToArray();

var msbuildPath = "<msbuildpath>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void ItAddsOutputPathToMsBuildInvocation(string optionName)

var msbuildPath = "<msbuildpath>";
StoreCommand.FromArgs(args, msbuildPath)
.GetArgumentsToMSBuild().Should().Be($"{ExpectedPrefix} -property:ComposeDir={Path.GetFullPath(path)} -property:_CommandLineDefinedOutputPath=true");
.GetArgumentsToMSBuild().Should().Be($"{ExpectedPrefix} -property:ComposeDir={Path.GetFullPath(path)}{Path.DirectorySeparatorChar} -property:_CommandLineDefinedOutputPath=true");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -834,9 +834,9 @@ _testhost() {
'-f=[The target framework to run for. The target framework must also be specified in the project file.]:FRAMEWORK:->dotnet_dynamic_complete' \
'--runtime=[]:RUNTIME_IDENTIFIER:->dotnet_dynamic_complete' \
'-r=[]:RUNTIME_IDENTIFIER:->dotnet_dynamic_complete' \
'--project=[The path to the project file to run (defaults to the current directory if there is only one project).]: : ' \
'--launch-profile=[The name of the launch profile (if any) to use when launching the application.]: : ' \
'-lp=[The name of the launch profile (if any) to use when launching the application.]: : ' \
'--project=[The path to the project file to run (defaults to the current directory if there is only one project).]:project: ' \
'--launch-profile=[The name of the launch profile (if any) to use when launching the application.]:launch-profile: ' \
'-lp=[The name of the launch profile (if any) to use when launching the application.]:launch-profile: ' \
'--no-launch-profile[Do not attempt to use launchSettings.json to configure the application.]' \
'--no-build[Do not build the project before running. Implies --no-restore.]' \
'--interactive=[Allows the command to stop and wait for user input or action (for example to complete authentication).]: :((False\:"False" True\:"True" ))' \
Expand Down
Loading