Kevin-Bronsdijk/nuget-pre-release-packages-detection-action

Backslashes in .sln's project paths cause file not found error on ubuntu github runner

Opened this issue · 0 comments

When an .sln file contains references to .csproj files that are in a subdirectory from the .sln with backslashes, I get the error ENOENT: no such file or directory, open 'path\to\Project.csproj'.

I can work around this by manually converting backslashes to forward slashes in the .sln file before running this action.

I'm using the 042c7b08f8e68b3bc8a8a85554e0e972457102f8 version of the action, which I believe is 1.5.1. I think that's the correct, latest version.

To reproduce:

An example .sln

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32901.215
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyProject", "src\MyProject\MyProject.csproj", "{BA0CA76F-FE53-4B1C-8412-1E1C2D591036}"
EndProject
Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
                Release|Any CPU = Release|Any CPU
        EndGlobalSection
        GlobalSection(ProjectConfigurationPlatforms) = postSolution
                {BA0CA76F-FE53-4B1C-8412-1E1C2D591036}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {BA0CA76F-FE53-4B1C-8412-1E1C2D591036}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {BA0CA76F-FE53-4B1C-8412-1E1C2D591036}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {BA0CA76F-FE53-4B1C-8412-1E1C2D591036}.Release|Any CPU.Build.0 = Release|Any CPU
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
        EndGlobalSection
        GlobalSection(ExtensibilityGlobals) = postSolution
                SolutionGuid = {454F74A6-3C8E-4E10-BE6D-AB2AC77E9865}
        EndGlobalSection
EndGlobal

Relevant sections of the GitHub Workflow yaml:

jobs:
  detect-prerelease:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      # removing this next line causes the file-not-found failure in the prerelease detection action
      - run tr '\\' '/' <MyProject.sln >MyProject.fixed.sln && mv MyProject.fixed.sln MyProject.sln
      - uses: kevin-bronsdijk/nuget-pre-release-packages-detection-action@042c7b08f8e68b3bc8a8a85554e0e972457102f8 #v1.5.1
        with:
          solution-file-name: 'MyProject.sln'
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-dotnet@v3
        with:
          dotnet-version: '6'
      # this works just fine with the backslashes
      - run: dotnet build MyProject.sln

For completeness' sake, here's the file/directory structure implied by the above:

./
├── MyProject.sln
│   └── src/
│       └── MyProject/
│           ├── MyProject.csproj
│           └── **/*.cs
└── .github/
    └── workflows/
        └── my-workflow.yml