BHoM / BHoM/Test_Toolkit

TestRunner.exe not deployed to the assemblies folder

Open
#550 0 comments 0 reactions 1 assignee Claimed by @adecler View on GitHub
type:bug
Dominant language
C#
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

#### Description:

TestRunner can no longer be run locally. Seemingly related to the SDK-style upgrade (https://github.com/BHoM/Test_Toolkit/pull/540) which moved it from `net472` to `net8.0`.

Two things are broken:

1. `TestRunner.exe` never reaches `C:\ProgramData\BHoM\Assemblies`. The post-build still copies `$(TargetDir)$(TargetFileName)`, and on .NET Core `$(TargetFileName)` is `TestRunner.dll`, not the exe. Checked on a minimal net8.0 exe: `TargetFileName = TestRunner.dll`, `TargetExt = .dll`. The exe is built, it just isn't copied.

2. Copying the exe across by hand doesn't help either. `BHoM`, `Test_oM` etc. are referenced with `Private=False`, so they are never copied next to the output. On .NET Framework that was fine because the exe was deployed into the assemblies folder and the runtime probed the app base directory. .NET Core builds its assembly list from `deps.json`, and a `Private=False` reference is compile-only so it never appears there. Confirmed on a minimal repro: with `deps.json` present the dependency sitting directly next to the exe still fails; delete `deps.json` and it loads.

Deleting `deps.json` only moves the failure along one assembly at a time (`Test_oM`, then `Test_Engine`, then the package dlls), since the folder then has to hold the whole dependency closure.

Ruled out while diagnosing:
- The `` pattern does still fire under the SDK, verified on a probe (`1 File(s) copied`).
- `BHoM.dll` and `Test_oM.dll` are netstandard2.0 and load fine on net8, so the dependencies' target framework is not the problem.

Also worth flagging: build output has moved from `Build\` to `Build\net8.0\` (and `Build\netstandard2.0\` for the libraries), as `AppendTargetFrameworkToOutputPath` defaults to true and isn't set anywhere.

#### Steps to reproduce:

1. Build the toolkit.
2. Run `C:\ProgramData\BHoM\Assemblies\TestRunner.exe `.

```
'C:\ProgramData\BHoM\Assemblies\TestRunner.exe' is not recognized as an internal or external command
```

3. Copy `TestRunner.exe`, `TestRunner.dll` and `TestRunner.runtimeconfig.json` from `Build\net8.0\` into the assemblies folder and run it again.

```
Unhandled exception. System.IO.FileNotFoundException:
Could not load file or assembly 'Test_oM, Version=9.0.0.0, Culture=neutral, PublicKeyToken=null'.
at TestRunner.Program.Main(String[] args)
```

#### Expected behaviour:

TestRunner is runnable locally after a build.

#### Test file(s):

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.