Skip to content

'dotnet test' broken after upgrading .NET SDK from 7.0.302 to 8.0.100 #38473

Closed

Description

@AArnott

Describe the bug

dotnet test fails with the following error after upgrading to the .NET 8 SDK:

  An assembly specified in the application dependencies manifest (testhost.deps.json) was not found:
    package: 'NuGet.Frameworks', version: '6.5.0'
    path: 'lib/netstandard2.0/NuGet.Frameworks.dll'
. Please check the diagnostic logs for more information.

To Reproduce

git clone https://devdiv@dev.azure.com/devdiv/DevDiv/_git/VS.CloudCache
cd VS.CloudCache
git checkout f89f466
cd test\Microsoft.VisualStudio.Cache.Tests
dotnet test

It works.

Now change global.json at the repo root to consume 8.0.100 of the .NET SDK:

-    "version": "7.0.302",
+    "version": "8.0.100",

Run dotnet test again, and it'll fail:


  Determining projects to restore...
  Restored C:\Users\andarno\source\repos\VS.CloudCache\src\Microsoft.VisualStudio.Cache\Microsoft.VisualStudio.Cache.csproj (in 2.25 sec).
  Restored C:\Users\andarno\source\repos\VS.CloudCache\test\Microsoft.VisualStudio.Cache.Tests\Microsoft.VisualStudio.Cache.Tests.csproj (in 4.23 sec).
  Microsoft.VisualStudio.Cache -> C:\Users\andarno\source\repos\VS.CloudCache\bin\Microsoft.VisualStudio.Cache\Debug\net6.0-windows10.0.19041\Microsoft.VisualStudio.Cache.dll
  Microsoft.VisualStudio.Cache.Tests -> C:\Users\andarno\source\repos\VS.CloudCache\bin\Microsoft.VisualStudio.Cache.Tests\x64\Debug\net6.0-windows10.0.19041\win-x64\Microsoft.VisualStudio.Cache.Tests.dll
Test run for C:\Users\andarno\source\repos\VS.CloudCache\bin\Microsoft.VisualStudio.Cache.Tests\x64\Debug\net6.0-windows10.0.19041\win-x64\Microsoft.VisualStudio.Cache.Tests.dll (.NETCoreApp,Version=v6.0)
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.
Testhost process for source(s) 'C:\Users\andarno\source\repos\VS.CloudCache\bin\Microsoft.VisualStudio.Cache.Tests\x64\Debug\net6.0-windows10.0.19041\win-x64\Microsoft.VisualStudio.Cache.Tests.dll' exited with error: Error:
  An assembly specified in the application dependencies manifest (testhost.deps.json) was not found:
    package: 'NuGet.Frameworks', version: '6.5.0'
    path: 'lib/netstandard2.0/NuGet.Frameworks.dll'
. Please check the diagnostic logs for more information.

Test Run Aborted.

Build FAILED.
    0 Warning(s)
    0 Error(s)

I have no idea why it would fail like this, considering this test has no NuGet.Frameworks dependency at all. And I can't find a testhost.deps.json file in the output directory either.

dotnet --info output in details:

Details dotnet --info .NET SDK: Version: 8.0.101 Commit: 6eceda187b Workload version: 8.0.100-manifests.077a4f18

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22621
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.101\

.NET workloads installed:
Workload version: 8.0.100-manifests.077a4f18
[aspire]
Installation Source: VS 17.10.34601.30, VS 17.10.34531.228
Manifest Version: 8.0.0-preview.1.23557.2/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.0.0-preview.1.23557.2\WorkloadManifest.json
Install Type: Msi

Host:
Version: 8.0.1
Architecture: x64
Commit: bf5e279d92

.NET SDKs installed:
6.0.418 [C:\Program Files\dotnet\sdk]
7.0.115 [C:\Program Files\dotnet\sdk]
7.0.203 [C:\Program Files\dotnet\sdk]
7.0.312 [C:\Program Files\dotnet\sdk]
7.0.405 [C:\Program Files\dotnet\sdk]
8.0.101 [C:\Program Files\dotnet\sdk]
8.0.200-preview.24060.48 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
C:\Users\andarno\source\repos\VS.CloudCache\global.json

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Activity

  1. ghost added
    untriagedRequest triage from a team member
    on Feb 1, 2024
  2. vitek-karas commented on Feb 2, 2024

    @vitek-karas
    Member

    @nohwnd Could you please redirect as appropriate?

  3. nohwnd commented on Feb 2, 2024

    @nohwnd
    Member

    Nuget.Frameworks is a dependency of testhost. But your project is not referencing Microsoft.NET.SDK so it falls back to using testhost that we ship in dotnet folder.

    exec --runtimeconfig "S:\c\VS.CloudCache\bin\Microsoft.VisualStudio.Cache.Tests\x64\Debug\net6.0-windows10.0.19041\win-x64\Microsoft.VisualStudio.Cache.Tests.runtimeconfig.json" --depsfile "S:\c\VS.CloudCache\bin\Microsoft.VisualStudio.Cache.Tests\x64\Debug\net6.0-windows10.0.19041\win-x64\Microsoft.VisualStudio.Cache.Tests.deps.json" --additional-deps "C:\Program Files\dotnet\sdk\8.0.101\testhost.deps.json" --additionalprobingpath "C:\Program Files\dotnet\sdk\8.0.101" "C:\Program Files\dotnet\sdk\8.0.101\testhost.dll" --port 18553 --endpoint 127.0.0.1:018553 --role client --parentprocessid 51516 --diag "S:\c\VS.CloudCache\test\Microsoft.VisualStudio.Cache.Tests\logs\dotnet_51516.host.24-02-02_13-07-20_60928_5.diag" --tracelevel 4 --telemetryoptedin false'

    dotnet sdk is replacing our version of nuget.frameworks so I guess this fallback is broken again. Posted a PR to the repo, so it does not hit this fallback.

    https://dev.azure.com/devdiv/DevDiv/_git/VS.CloudCache/pullrequest/526038

  4. nohwnd commented on Feb 2, 2024

    @nohwnd
    Member

    Will fix on vstest microsoft/vstest#4875 . And probably add test in here.

    Closing because projects should reference Microsoft.NET.Test.SDK if possible. Which this project can and it fixes it.

  5. AArnott commented on Feb 2, 2024

    @AArnott
    ContributorAuthor

    Thanks, @nohwnd!

  6. robertmclaws commented on Mar 27, 2024

    @robertmclaws

    Referencing the Microsoft.NET.Test.Sdk NuGet package did NOT fix this issue for dotnet test commands. They are still failing in build environments.

    Still experiencing the issue on .NET 8.0.203 when referencing the following packages in test projects:

    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.*-*" />
    <PackageReference Include="Microsoft.TestPlatform" Version="17.*-*" />
    
  7. PauloJoseBR commented on Apr 9, 2024

    @PauloJoseBR

    I got the same problem @robertmclaws. Have you found a solution?

  8. duongphuhiep commented on Apr 10, 2024

    @duongphuhiep

    up vote

  9. nohwnd commented on Apr 10, 2024

    @nohwnd
    Member

    The technical issue was the same for Robert. He had a project that was marked as a test project, but it didn’t have the Microsoft.NET.Test.SDK installed.

    In their case they set true build property on their utility project. This property tells vstest to run tests from it.

    Solution for them was to not set that property.

  10. added a commit that references this issue on Jun 20, 2024
  11. LeonardoDaLuz commented on Jan 13, 2025

    @LeonardoDaLuz

    Delete the virus comment above.

  12. deleted a comment from heart-king on Jan 13, 2025
  13. deleted a comment from heart-king on Jan 13, 2025
  14. Mertsch commented on Feb 16, 2026

    @Mertsch

    If you come here with

      An assembly specified in the application dependencies manifest (testhost.deps.json) was not found:
        package: 'testhost', version: '18.0.1-release-26075-103'
        path: 'testhost.dll'
    . Please check the diagnostic logs for more information.
    

    This happens when you try to run MTP tests with VSTest.
    In Azure DevOps, use

    - task: DotNetCoreCLI@2 # https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/dotnet-core-cli-v2#test
      inputs:
        command: custom
        custom: test
        workingDirectory: '$(Pipeline.Workspace)/Tests'
        arguments: >-
          --test-modules "**/*Tests.dll"
          --settings "Default.runsettings"
          --report-trx
          --results-directory "$(Agent.TempDirectory)"
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions