C
C#7mo ago
Tvde1

dotnet test on Azure Devops has .NET 8 and requires .NET 6 and crashes?

I'm getting the following logs when attempting to run .NET tests:
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Testhost process for source(s) '/home/vsts/work/1/s/[redacted].Test/bin/Release/net6.0/win-x64/[redacted].Test.dll' exited with error: You must install or update .NET to run this application.
App: /home/vsts/work/1/s/CommonProjects/[redacted].Test/bin/Release/net6.0/win-x64/testhost.dll
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '6.0.0' (x64)
.NET location: /opt/hostedtoolcache/dotnet/
The following frameworks were found:
8.0.6 at [/opt/hostedtoolcache/dotnet/shared/Microsoft.NETCore.App]
Learn more:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=x64&rid=linux-x64&os=ubuntu.22.04
. Please check the diagnostic logs for more information.
Results File: /home/vsts/work/_temp/_fv-az633-354_2024-05-31_14_52_14.trx
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Testhost process for source(s) '/home/vsts/work/1/s/[redacted].Test/bin/Release/net6.0/win-x64/[redacted].Test.dll' exited with error: You must install or update .NET to run this application.
App: /home/vsts/work/1/s/CommonProjects/[redacted].Test/bin/Release/net6.0/win-x64/testhost.dll
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '6.0.0' (x64)
.NET location: /opt/hostedtoolcache/dotnet/
The following frameworks were found:
8.0.6 at [/opt/hostedtoolcache/dotnet/shared/Microsoft.NETCore.App]
Learn more:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=x64&rid=linux-x64&os=ubuntu.22.04
. Please check the diagnostic logs for more information.
Results File: /home/vsts/work/_temp/_fv-az633-354_2024-05-31_14_52_14.trx
.NET 8 is installed using
steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
version: 8.x
performMultiLevelLookup: true
includePreviewVersions: false
steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
version: 8.x
performMultiLevelLookup: true
includePreviewVersions: false
and I'm running tests using
- task: DotNetCoreCLI@2
displayName: 'Test assemblies'
inputs:
command: 'test'
projects: '**/bin/**/*.Test.dll'
arguments: '-s .runsettings'
- task: DotNetCoreCLI@2
displayName: 'Test assemblies'
inputs:
command: 'test'
projects: '**/bin/**/*.Test.dll'
arguments: '-s .runsettings'
4 Replies
Tvde1
Tvde1OP7mo ago
For context, the .runsettings file is:
<RunSettings>
<!-- Configurations that affect the Test Framework -->
<RunConfiguration>
<!-- Path relative to solution directory -->
<TargetPlatform>x64</TargetPlatform>
<TreatNoTestsAsError>true</TreatNoTestsAsError>
</RunConfiguration>
<MSTest>
<TreatNoTestsAsError>true</TreatNoTestsAsError>
<MaxCpuCount>0</MaxCpuCount>
<MapInconclusiveToFailed>True</MapInconclusiveToFailed>
</MSTest>
</RunSettings>
<RunSettings>
<!-- Configurations that affect the Test Framework -->
<RunConfiguration>
<!-- Path relative to solution directory -->
<TargetPlatform>x64</TargetPlatform>
<TreatNoTestsAsError>true</TreatNoTestsAsError>
</RunConfiguration>
<MSTest>
<TreatNoTestsAsError>true</TreatNoTestsAsError>
<MaxCpuCount>0</MaxCpuCount>
<MapInconclusiveToFailed>True</MapInconclusiveToFailed>
</MSTest>
</RunSettings>
Not sure why this exists, but this does not mention any .NET version I'm going to try with:
- task: DotNetCoreCLI@2
displayName: 'Test assemblies'
inputs:
command: 'test'
projects: '**/*.Test.csproj'
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Test assemblies'
inputs:
command: 'test'
projects: '**/*.Test.csproj'
arguments: '--configuration $(buildConfiguration)'
qqdev
qqdev7mo ago
Did you specify 6.0 in the csproj file?
Tvde1
Tvde1OP7mo ago
Yes To my knowledge, if you install .NET 8, it installs .NET 6 too, right?
qqdev
qqdev7mo ago
It’s usually downwards compatible yeah But I also had some cases in the past where stuff was weird and where I had to install the explicit version of .NET
Want results from more Discord servers?
Add your server