Skip to content

Build server warnings - Could not load file or assembly 'Microsoft.CodeAnalysis' #5126

Closed
@C-Wal

Description

@C-Wal

Describe the bug

I am getting a stack of these warnings on my build server and I believe it's breaking test discovery in my pipeline:

##[warning]CSC(0,0): Warning CS8032: An instance of analyzer MSTest.Analyzers.UseAttributeOnTestMethodAnalyzer cannot be created from path\to\packages\MSTest.Analyzers.3.3.1\analyzers\dotnet\cs\MSTest.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..

With a line like this for a whole pile of analyzers in MSTest.Analyzers.

I do not have this issue locally in VS 2022.

Looking at the MSTest.Analyzers.3.3.1 nuget package it declares no dependencies so why is it looking for and failing to find Microsoft.CodeAnalysis?

Steps To Reproduce

.Net Framework 4.8 test project.
Add MSTest.TestFramework 3.3.1 nuget package.
Build on TFS with 2017 Enterprise build agent.

Expected behavior

No warnings, same as in VS 2022.

Actual behavior

Lots of warnings, tests not discovered.

Additional context

I am aware .Net Framework 4.8 and a VS 2017 build agent are old-hat but they are what I've got to work with on this.

I tried using the latest MSTest.TestFramework but it didn't fix it either. I also tried installing the Microsft.CodeAnalysis 3.11 package into my project and I still get exactly the same warnings about it being not found.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions