Skip to content

Commit 0e380a0

Browse files
authored
Merge branch 'main' into merge/release/10.0.2xx-to-main
2 parents a32c98c + 02fc420 commit 0e380a0

File tree

4 files changed

+43
-6
lines changed

4 files changed

+43
-6
lines changed

eng/Version.Details.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ This file should be imported by eng/Versions.props
140140
<!-- dotnet/core-setup dependencies -->
141141
<NETStandardLibraryRefPackageVersion>2.1.0</NETStandardLibraryRefPackageVersion>
142142
<!-- microsoft/testfx dependencies -->
143-
<MicrosoftTestingPlatformPackageVersion>2.1.0-preview.25523.1</MicrosoftTestingPlatformPackageVersion>
144-
<MSTestPackageVersion>4.1.0-preview.25523.1</MSTestPackageVersion>
143+
<MicrosoftTestingPlatformPackageVersion>2.1.0-preview.25525.1</MicrosoftTestingPlatformPackageVersion>
144+
<MSTestPackageVersion>4.1.0-preview.25525.1</MSTestPackageVersion>
145145
</PropertyGroup>
146146
<!--Property group for alternate package version names-->
147147
<PropertyGroup>

eng/Version.Details.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,13 +553,13 @@
553553
<Uri>https://github.com/dotnet/dotnet</Uri>
554554
<Sha>be28ec777bf12db631725399c442448d52093087</Sha>
555555
</Dependency>
556-
<Dependency Name="Microsoft.Testing.Platform" Version="2.1.0-preview.25523.1">
556+
<Dependency Name="Microsoft.Testing.Platform" Version="2.1.0-preview.25525.1">
557557
<Uri>https://github.com/microsoft/testfx</Uri>
558-
<Sha>b349d2e4c023548494bc5f2f031a08376a287563</Sha>
558+
<Sha>82daaae2be64c7d3058a15656781bbf790e4e628</Sha>
559559
</Dependency>
560-
<Dependency Name="MSTest" Version="4.1.0-preview.25523.1">
560+
<Dependency Name="MSTest" Version="4.1.0-preview.25525.1">
561561
<Uri>https://github.com/microsoft/testfx</Uri>
562-
<Sha>b349d2e4c023548494bc5f2f031a08376a287563</Sha>
562+
<Sha>82daaae2be64c7d3058a15656781bbf790e4e628</Sha>
563563
</Dependency>
564564
<Dependency Name="Microsoft.Extensions.Configuration.Ini" Version="10.0.0-rc.1.25515.110">
565565
<Uri>https://github.com/dotnet/dotnet</Uri>

src/Cli/dotnet/Commands/Run/RunCommand.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,15 @@ internal static void ThrowUnableToRunError(ProjectInstance project)
538538
projectFileOrDirectoryPath = Directory.GetCurrentDirectory();
539539
}
540540

541+
// Normalize path separators to handle Windows-style paths on non-Windows platforms.
542+
// This is supported for backward compatibility in 'dotnet run' only, not for all CLI commands.
543+
// Converting backslashes to forward slashes allows PowerShell scripts using Windows-style paths
544+
// to work cross-platform, maintaining compatibility with .NET 9 behavior.
545+
if (Path.DirectorySeparatorChar != '\\')
546+
{
547+
projectFileOrDirectoryPath = projectFileOrDirectoryPath.Replace('\\', '/');
548+
}
549+
541550
string? projectFilePath = Directory.Exists(projectFileOrDirectoryPath)
542551
? TryFindSingleProjectInDirectory(projectFileOrDirectoryPath)
543552
: projectFileOrDirectoryPath;

test/dotnet.Tests/CommandTests/Run/RunParserTests.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,33 @@ public void RunParserCanGetArgumentFromDoubleDash()
2727
var runCommand = RunCommand.FromArgs(new[] { "--project", projectPath, "--", "foo" });
2828
runCommand.ApplicationArgs.Single().Should().Be("foo");
2929
}
30+
31+
[WindowsOnlyFact]
32+
public void RunParserAcceptsWindowsPathSeparatorsOnWindows()
33+
{
34+
var tam = new TestAssetsManager(output);
35+
var testAsset = tam.CopyTestAsset("HelloWorld").WithSource();
36+
var newWorkingDir = testAsset.Path;
37+
38+
Directory.SetCurrentDirectory(newWorkingDir);
39+
var projectPath = @".\HelloWorld.csproj";
40+
// Should not throw on Windows
41+
var runCommand = RunCommand.FromArgs(new[] { "--project", projectPath });
42+
runCommand.ProjectFileFullPath.Should().NotBeNull();
43+
}
44+
45+
[UnixOnlyFact]
46+
public void RunParserAcceptsWindowsPathSeparatorsOnLinux()
47+
{
48+
var tam = new TestAssetsManager(output);
49+
var testAsset = tam.CopyTestAsset("HelloWorld").WithSource();
50+
var newWorkingDir = testAsset.Path;
51+
52+
Directory.SetCurrentDirectory(newWorkingDir);
53+
var projectPath = @".\HelloWorld.csproj";
54+
// Should not throw on Linux with backslash separators
55+
var runCommand = RunCommand.FromArgs(new[] { "--project", projectPath });
56+
runCommand.ProjectFileFullPath.Should().NotBeNull();
57+
}
3058
}
3159
}

0 commit comments

Comments
 (0)