SpecFlow icon indicating copy to clipboard operation
SpecFlow copied to clipboard

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

Open GaTechThomas opened this issue 2 years ago • 0 comments

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

GaTechThomas avatar Dec 08 '23 21:12 GaTechThomas