msbuild: [Bug]: Harmless warning: The referenced component 'Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter' could not be found

Issue Description

Following @YuliiaKovalova advice by creating an issue here for a problem reported on MSTest: https://github.com/microsoft/testfx/issues/2173

Context On MSTest, we have a dll Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll that is copied to user output (to be picked up by vstest.console.exe) that we don’t add as reference to ensure the user doesn’t access public types declared in that dll.

With MSTest 3.2.0+, we introduced a new standalone runner and for this runner to work, we do need the dll to be referenced because the generated file we produce uses some types from this dll. We add this dll through a conditional Reference (see https://github.com/microsoft/testfx/blob/main/src/Adapter/Build/Common/MSTest.TestAdapter.targets#L34). There is a problem of declaration (that should be fixed by https://github.com/microsoft/testfx/pull/2220) but even fixing it I can still reproduce the issue.

Related issue I found the following issue that’s similar https://github.com/microsoft/appcenter-sdk-dotnet/issues/543 but their resolution was to remove the reference from the targets. I am wondering if I have any other option.

Steps to Reproduce

See https://github.com/microsoft/testfx/issues/2173

Expected Behavior

Dll should not be shown or shown without warning and no warning should be shown in the error list.

Actual Behavior

An error appears in the error list. The reference always appear and is annotated with a warning.

Analysis

Looking at the issue with Rainer it seems to be originating from csprojui.dll.

There is no warning emited in CLI nor in binlogs (CLI or VS one). I have also looked at the binlog produced using the specific debug environment variables but cannot find the issue either.

It would seems to be affecting only VS that seems to be ignoring the condition and seems to not be able to resolve the dll despite its existence. I have tried putting the condition on some ItemGroup but it’s not working either.

Versions & Configurations

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Sure, I will test what’s needed if possible 😃 Thanks for your fast reactions, people 😃

@Evangelink , we have had internal discussion on this bug from ProjectSystem perspective and agreed to close it “by Design”, since we have a workaround and applying any aggressive changes might cause unexpected consequences due to compatibility challenges.

Thank you for your time and quick responsiveness!

@Evangelink Thanks, it looks like the 3.2.2-preview adapter makes the warning go away 😃 FYI, the project was migrated to PackageReference in the meantime. What I did was, downlaod the nuget package, open it in 7-zip, enter folder build/net462 and extracted all files under C:\Users<my username>.nuget\packages\mstest.testadapter\3.2.1\build\net462 I’m not sure that is the correct way to test it, but it worked, it seems 😃 Can you please publish an official version of this nuget package?

Let me test out this solution. If that’s working nice locally, I will publish a preview package @Mek7 would you be ok to test it? I would then release 3.2.2 with this bug fix if that’s fixing it all.

Thanks for the investigation @YuliiaKovalova!!

Even if that’s ignoring the condition, why is it considering that the dll doesn’t exist when it actually does?

I have done some investigation from my side - it looks like a bug/feature in project system (csproj). if you flip condition , the reference is still displayed, but without warning. In both cases this reference persists. Plan to dig more this month.