reqnroll / Reqnroll

Open-source Cucumber-style BDD test automation framework for .NET.
https://reqnroll.net
BSD 3-Clause "New" or "Revised" License
302 stars 33 forks source link

Building a Reqnroll project on macOS ARM64 architecture (eg MacBook M1) fails #152

Closed gasparnagy closed 1 month ago

gasparnagy commented 1 month ago

Reqnroll Version

2.0.0

Which test runner are you using?

MSTest

Test Runner Version Number

n/a

.NET Implementation

.NET 8.0

Test Execution Method

Other – PLEASE SPECIFY

Content of reqnroll.json configuration file

No response

Issue Description

It seems that Reqnroll v2.0.0 projects fail to build on MacOS ARM64 processor machines.

The error message is similar to this:

/Users/<user>/.nuget/packages/reqnroll.mstest/2.0.0/build/Reqnroll.MsTest.targets(34,5): error MSB4216: Could not run the "ReplaceTokenInFileTask" task because MSBuild could not create or connect to a task host with runtime "NET" and architecture "arm64".  Please ensure that (1) the requested runtime and/or architecture are available on the machine, and (2) that the required executable "MSBuild.exe" exists and can be run. [/Users/seb/Projects/Quickstart/ReqnrollQuickstart.Specs/ReqnrollQuickstart.Specs.csproj]
    0 Warning(s)
    1 Error(s)

Related discussion: https://github.com/orgs/reqnroll/discussions/143

With Reqnroll 1.0.0 it works!

Steps to Reproduce

Link to Repro Project

No response

gasparnagy commented 1 month ago

After some debugging, it seems that the problem is caused by the change: https://github.com/reqnroll/Reqnroll/commit/5e81d0d0afb69c4a32ce0bd3e7c6b0f6ccf85113

If I remove the TaskFactory="TaskHostFactory" setting from the <UsingTask> entries at https://github.com/reqnroll/Reqnroll/blob/main/Reqnroll.Tools.MsBuild.Generation/build/Reqnroll.Tools.MsBuild.Generation.tasks#L9, the build starts to work.

We have introduced these settings to avoid file locks in Visual Studio when we develop Reqnroll itself, so probably the fix could be to somehow set this to conditional and only use it when it is calling from VS.