Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.3.0] You must install or update .NET to run this application. #3938

Closed
Kunter-Bunt opened this issue Aug 11, 2022 · 7 comments
Closed

[17.3.0] You must install or update .NET to run this application. #3938

Kunter-Bunt opened this issue Aug 11, 2022 · 7 comments
Labels

Comments

@Kunter-Bunt
Copy link

Description

Running Tests in Azure DevOps produces the following error with a .NET Framework Solution.

##[error]Testhost process exited with error: You must install or update .NET to run this application.
##[error]App: C:\hostedtoolcache\windows\VsTest\17.3.0\x64\tools\net451\Common7\IDE\Extensions\TestPlatform\TestHost\testhost.dll
##[error]Architecture: x64
##[error]Framework: 'Microsoft.NETCore.App', version '2.0.0-preview.0' (x64)
##[error].NET location: C:\Program Files\dotnet\
##[error]The following frameworks were found:
##[error]  3.1.4 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
##[error]  3.1.6 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
##[error]  3.1.20 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
##[error]  3.1.26 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
##[error]  3.1.27 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
##[error]  5.0.4 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
##[error]  5.0.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
##[error]  5.0.17 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
##[error]  6.0.6 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
##[error]  6.0.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
##[error]Learn about framework resolution:
##[error]https://aka.ms/dotnet/app-launch-failed
##[error]To install missing framework, download:
##[error]https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=2.0.0-preview.0&arch=x64&rid=win10-x64
##[error]. Please check the diagnostic logs for more information.

Assumption: Since the problem started when the installer started installing Version 17.3.0 instead of 17.2.0, it is assumed this is not a problem of Azure DevOps with vmImage: 'windows-latest'.

Steps to reproduce

With the following Setup of YAML Pipeline Tasks

  - task: VisualStudioTestPlatformInstaller@1
    displayName: "VsTest Platform Installer"
    inputs:
      versionSelector: "latestStable" #version 17.3.0

  - task: VSTest@2
    displayName: "Run .NET Tests"
    inputs:
      testAssemblyVer2: |
        **\release\**\*test*.dll
        !**\obj\**
        !**\node_modules
        !**\Microsoft.VisualStudio.TestPlatform*.dll
      vsTestVersion: "toolsInstaller"
      testRunTitle: ".NET Tests"
      codeCoverageEnabled: true
      runSettingsFile: ".../default.runsettings"
      platform: "Any CPU"
      configuration: release
      publishRunAttachments: true

Error can be reproduced, even with a Commit as base that had a successful build before the weekend.

Test Projects are in .NET Version 4.6.2.

Expected behavior

Tests Task fails if Tests do not work, it should run green if all Tests are passed.

Workaround

Specifying the previous version 17.2.0 fixes the problem.

- task: VisualStudioTestPlatformInstaller@1
    displayName: "VsTest Platform Installer"
    inputs:
      versionSelector: "SpecificVersion"
      testPlatformVersion: "17.2.0"

Actual behavior

Error is thrown as shown in Description.
Note: The error is thrown after the Tests are run, so there are more that 100 passed tests in the published result.

Environment

Azure Devops Pipeline with vmImage: 'windows-latest'.

@nohwnd
Copy link
Member

nohwnd commented Aug 11, 2022

The output message complains about .NET "Core" not being found, and based on the verison " '2.0.0-preview.0' " it looks like a fallback is used to a very old version that is out of life.

I see you say that your project is not .NET Core, but rather .NET Frameworks 4.6.2. It looks like additional dll is trying to run after your tests. Could you please check the build output to see how many dlls matched and if it says in the output which dlls are running? Is any of those dlls not expected to run?

Providing diagnostic logs would also help, if that is possible for you https://github.com/microsoft/vstest-docs/blob/main/docs/diagnose.md

@Kunter-Bunt
Copy link
Author

vstest.console.exe "...\bin\Release...Sdk.Testing.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...Sdk.Testing.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...Sdk.Testing.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...Sdk.Testing.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...Sdk.Testing.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...Sdk.Testing.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...Sdk.Testing.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...Sdk.Testing.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...Sdk.Testing.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...Sdk.Testing.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...Sdk.Testing.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...Commands.Integration.Tests.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...Commands.Tests.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release\net462\Microsoft.TestPlatform.AdapterUtilities.dll"-> .NETStandard,Version=v2.0
"...\bin\Release...Abc.Integration.Tests.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...Abc.Tests.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...BusinessLogic.Tests.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release\net462\Microsoft.TestPlatform.AdapterUtilities.dll"-> .NETStandard,Version=v2.0
"...\bin\Release....Data.Tests.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release\net462\Microsoft.TestPlatform.AdapterUtilities.dll"-> .NETStandard,Version=v2.0
"...\bin\Release...Plugins.Integration.Tests.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release...Plugins.Tests.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release\net462\Microsoft.TestPlatform.AdapterUtilities.dll"-> .NETStandard,Version=v2.0
"...\bin\Release...Workflows.Tests.dll" -> .NETFramework,Version=v4.6.2
"...\bin\Release\net462\Microsoft.TestPlatform.AdapterUtilities.dll"-> .NETStandard,Version=v2.0
/TestCaseFilter:"TestCategory!=Integration"
/Settings:"D:\a_temp\flh2g4enhei.tmp.runsettings"
/Logger:"trx"
/TestAdapterPath:"D:\a\1\s"
Starting test execution, please wait...
A total of 25 test files matched the specified pattern.

I cant check right now, but might be the Adapter Utilities which are not correctly excluded in the filter that are causing the issue with .net core.
I will update with a test where the filter is adapted later.

@nohwnd
Copy link
Member

nohwnd commented Aug 11, 2022

Yeah there is another issue where I am thinking the same, I am guessing that this would be caused by multi-tfm, that would previously skip the dll because it is not .net framework. I am building a pipeline to get repro, locally I see it fail even on 17.2.0 (but did not try your exact case yet).

@nohwnd
Copy link
Member

nohwnd commented Aug 11, 2022

openend #3939 with suggested filters to use while we are fixing it.

@Kunter-Bunt
Copy link
Author

So, some confirmation because I had the same problem on a different project today: Not only rollback to 17.2.0 works but also correcting the filter to exclude the AdapterUtilities.dll.

How to:
Check your logs for the call to the vstest.console.exe. Does it include Microsoft.TestPlatform.AdapterUtilities.dll?
If yes, add this exclusion to the VS Test Task: !**\Microsoft.TestPlatform*.dll
After this change my VSTest Task looks like this:

  - task: VSTest@2
    displayName: "Run .NET Tests"
    inputs:
      testAssemblyVer2: |
        **\release\**\*test*.dll
        !**\obj\**
        !**\node_modules
        !**\Microsoft.VisualStudio.TestPlatform*.dll
        !**\Microsoft.TestPlatform*.dll
      vsTestVersion: "toolsInstaller"
      testRunTitle: ".NET Tests"
      codeCoverageEnabled: true
      runSettingsFile: ".../default.runsettings"
      platform: "Any CPU"
      configuration: release
      publishRunAttachments: true

The issue will probably not affect everyone because it relates to these projects have older exclusions where the namespace contained VisualStudio which does not match the assembly.

@Evangelink Evangelink added the bug label Nov 29, 2022
@MarcoRossignoli
Copy link
Contributor

MarcoRossignoli commented Dec 15, 2022

Close this one because a suggestion was given by the comment #3938 (comment)

@techwizard210
Copy link

okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants