When using the package Microsoft.NET.Test.Sdk as GlobalPackageReference in a Directory.Packages.props the build fails with this error:
CS0234 The type or namespace name 'TestPlatform' does not exist in the namespace 'Microsoft.VisualStudio' (are you missing an assembly reference?)
Project1.Tests
%UserProfile%\.nuget\packages\microsoft.net.test.sdk\17.10.0\build\netcoreapp3.1\Microsoft.NET.Test.Sdk.Program.cs 3
Using it as normal PackageReference in the .csproj works fine.
Steps to reproduce
create a new project
create a Directory.Packages.props and set ManagePackageVersionsCentrally = true
CS0234 The type or namespace name 'TestPlatform' does not exist in the namespace 'Microsoft.VisualStudio' (are you missing an assembly reference?)
Project1.Tests
%UserProfile%\.nuget\packages\microsoft.net.test.sdk\17.10.0\build\netcoreapp3.1\Microsoft.NET.Test.Sdk.Program.cs 3
Diagnostic logs
Since the build fails, I cannot run the tests with diagnostics.
Description
When using the package Microsoft.NET.Test.Sdk as GlobalPackageReference in a Directory.Packages.props the build fails with this error:
Using it as normal PackageReference in the .csproj works fine.
Steps to reproduce
<GlobalPackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
I created a small repo to demonstrate the issue: https://github.com/proj-arch/Microsoft.NET.Test.Sdk-GlobalPackageReference-BuildError
Expected behavior
the project can be successfully built
Actual behavior
the build breaks with the error
Diagnostic logs
Since the build fails, I cannot run the tests with diagnostics.
Environment