As per the title: testhost.exe is missing from disk when installing dev-dotnet/dotnet-sdk-8.0.100-r2 (or having it pulled in via installing dev-dotnet/dotnet-sdk). Many people are likely not to notice, but unfortunately, for a dev, this becomes a blocker. Output from `dotnet test`: Starting test execution, please wait... A total of 1 test files matched the specified pattern. Testhost process for source(s) '/home/daf/code/codeo/codeo.core/Tests.NetFX/bin/Debug/net462/Tests.NetFX.dll' exited with error: Cannot open assembly '/usr/lib64/dotnet-sdk-8.0/sdk/8.0.100/Extensions/../TestHostNetFramework/testhost.exe': No such file or directory Reproducible: Always Steps to Reproduce: 1. Install dev-dotnet/dotnet-sdk-8.0.100-r4 2. Attempt to run tests with `dotnet test` 3. Fail. Actual Results: `dotnet test` throws an error and exits, without running any tests` Expected Results: tests should run, as they do with dev-dotnet/dotnet-sdk-bin-8.0.100-r4 I see that there's an `~amd64` dotnet-sdk-8.0.101, which I haven't tested, so I'm not sure if this issue is present there. When I get a chance, I'll re-merge with ~amd64 and try again. For now, I need to work, so I've installed dotnet-sdk-bin instead.
Hello David! I can confirm those files are missing from source-built dotnet-sdk (both stable and unstable). But I have been running tests with source-built SDK successfully. Stracing the dotnet test call shows that only this DLL from lib64 is used: > /usr/lib64/dotnet-sdk-8.0/sdk/8.0.101/Extensions/Microsoft.TestPlatform.TestHostRuntimeProvider.dll I see that you are building for net462, so maybe that is the issue + the test framework that you use. I know for a fact this works with nunit and xunit under net8.0 runtime target. If you are building with nunit or xunit can you check if building for net6.0 and then net8.0 works? > -p:TargetFramework=net8.0 -p:TargetFrameworks=net8.0 Either way I do not yet know why testhost.exe might be missing from source-built.
If I try to craft a net462 project on 8.0.1 source to reproduce this is what I get: > Determining projects to restore... > All projects are up-to-date for restore. > Zzz -> /tmp/tmp.8axCGSKU.tmpsh/Zzz/bin/Debug/net462/Zzz.dll > Test run for /tmp/tmp.8axCGSKU.tmpsh/Zzz/bin/Debug/net462/Zzz.dll (.NETFramework,Version=v4.6.2) > Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64) > Copyright (c) Microsoft Corporation. All rights reserved. > > Starting test execution, please wait... > A total of 1 test files matched the specified pattern. > System.IO.FileNotFoundException: Could not find 'mono' host. Make sure that 'mono' is installed on the machine and is available in PATH environment variable. > at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.DotnetHostHelper.GetMonoPath() in /var/notmp/portage/dev-dotnet/dotnet-sdk-8.0.101/work/dotnet-sdk-8.0.1/src/vstest/artifacts/source-build/self/src/src/Microsoft.TestPlatform.CoreUtilities/Helpers/DotnetHostHelper.cs:line 93 > at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DefaultTestHostManager.GetTestHostProcessStartInfo(IEnumerable`1 sources, IDictionary`2 environmentVariables, TestRunnerConnectionInfo connectionInfo) in /var/notmp/portage/dev-dotnet/dotnet-sdk-8.0.101/work/dotnet-sdk-8.0.1/src/vstest/artifacts/source-build/self/src/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs:line 217 > at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, String runSettings) in /var/notmp/portage/dev-dotnet/dotnet-sdk-8.0.101/work/dotnet-sdk-8.0.1/src/vstest/artifacts/source-build/self/src/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs:line 226 > at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyExecutionManager.InitializeTestRun(TestRunCriteria testRunCriteria, IInternalTestRunEventsHandler eventHandler) in /var/notmp/portage/dev-dotnet/dotnet-sdk-8.0.101/work/dotnet-sdk-8.0.1/src/vstest/artifacts/source-build/self/src/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs:line 182 > > Test Run Aborted. I dont think we should support this use case since net462 is from before .NET Core but upstream distributes it ... :/
(In reply to Maciej Barć from comment #2) > If I try to craft a net462 project on 8.0.1 source to reproduce this is what > I get: > > > Determining projects to restore... > > All projects are up-to-date for restore. > > Zzz -> /tmp/tmp.8axCGSKU.tmpsh/Zzz/bin/Debug/net462/Zzz.dll This also happens on binary 8.0.1 and binary 8.0., so it is really a test framework issue - it wants mono and mono wants testhost.exe.
Hi, thanks for getting back to me (: You can easily build net462 targets with dotnet by providing dotnet the information as to where it should find an SDK api to compile against - which I do in NExpect (https://github.com/fluffynuts/NExpect/) and in other projects - check out https://github.com/fluffynuts/NExpect/blob/master/src/MonoForFramework.targets Note that this is _not_ "mono building" or "mono testing" - this is dotnet being instructed to find apis for system stuff in another location. The produced assebmlies aren't specifically linked to mono either. I've used this process to cross-build net5.0+ and net462 for some time now (: It 100% should be a supported workflow because, as I say, this isn't mono building the app - it's dotnet building the app and using mono assemblies for a reference for core runtime apis. You can take the produced assemblies and use 'em anywhere there's a net462-compatible host (so, .NET Framework 4.6.2+ on windows, or mono on linux or osx). In this same solution, I have a test host for netcore stuff (with a lot of cross-linking: most of what's in this library should work fine on net5.0+ or netfx - it doesn't matter). That project builds and tests just fine. The net462 one builds fine but only tests when using dotnet-sdk-bin packages. The missing testhost.exe, although it's just a wrapper around testhost.dll, is required. To reiterate: mono doesn't want anything - this is dotnet packaging failure. I could reproduce the same issue by breaking my dotnet-sdk-bin installations by deleting testhost.exe in each.
See also: https://github.com/dotnet/source-build/discussions/4095