SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.22k stars 751 forks source link

Run dotnet build in linux container fails with "Could not find part of the path..." #2730

Open GaTechThomas opened 6 months ago

GaTechThomas commented 6 months ago

SpecFlow Version

3.9.74

Which test runner are you using?

MSTest

Test Runner Version Number

3.1.1

.NET Implementation

.NET 6.0

Project Format of the SpecFlow project

Sdk-style project format

.feature.cs files are generated using

SpecFlow.Tools.MsBuild.Generation NuGet package

Test Execution Method

Command line – PLEASE SPECIFY THE FULL COMMAND LINE

SpecFlow Section in app.config or content of specflow.json

None.

Issue Description

Additional info: .NET8.0 project in devcontainer (image mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm). Host OS is Windows 11. Devcontainer is run from WSL / vscode.

Running dotnet build in a linux container has the following error:

**/*.feature : error : System.IO.DirectoryNotFoundException: Could not find a part of the path '/workspaces/dapr-poc-cb1/functionaltests/**/*.feature'. [/workspaces/dapr-poc-cb1/functionaltests/functionaltests.csproj]

After much digging I was able to create a workaround:

Add the following section to the .csproj file:

  <ItemGroup>
    <SpecFlowFeatureFiles Remove="**\*.feature" />
    <SpecFlowFeatureFiles Include="*\*.feature" />

    <EmbeddedResource Remove="**\*.resx" />
    <EmbeddedResource Include="*\*.resx" />

    <Compile Remove="**\*.cs" />
    <Compile Include="*\*.cs" />
  </ItemGroup>

It seems that the globbing with two stars is failing to enumerate files, whereas the single star works.

Steps to Reproduce

Run dotnet build.

Link to Repro Project

No response