locked
.NET Core MSTest project can't find VisualStudio type or namespace in Microsoft namespace RRS feed

  • Question

  • User-1367834679 posted

    VS2019

    I added a .NET Core 2.2 MSTest project and VS automatically added these dependencies :

    Microsoft.NET.Test.Sdk v16.0.1 ( I updated to v16.2.0 )
    Microsoft.NET.Test.Sdk v1.3.2 ( I updated to v1.4.0 )
    MSTest.TestFramework v1.3.2 ( I updated to v1.4.0 )


    I compile and get this error :

    CS0234 The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) ...\packages\microsoft.net.test.sdk\16.2.0\build\netcoreapp1.0\Microsoft.NET.Test.Sdk.Program.cs

    Couple of observations :

    1. Project is .NET Core 2.2 but it's using package from netcoreapp1.0 folder
    2. NuGet package manager successfully added package Microsoft.NET.Test.Sdk v16.0.1 but on build it has an unresolved reference

    Wednesday, September 4, 2019 4:41 AM

All replies

  • User-1038772411 posted

    Hello, jgrandydev

    please refer below microsoft document for add .net core MSTest project

    https://docs.microsoft.com/en-us/dotnet/core/tutorials/testing-library-with-visual-studio?tabs=csharp

    Thanks.

    Wednesday, September 4, 2019 5:37 AM
  • User711641945 posted

    Hi jgrandydev,

    jgrandydev

    Project is .NET Core 2.2 but it's using package from netcoreapp1.0 folder

    It is just the default folder name when you download Microsoft.NET.Test.Sdk. It is not related the version of ASP.Net Core.

    jgrandydev

    NuGet package manager successfully added package Microsoft.NET.Test.Sdk v16.0.1 but on build it has an unresolved reference

    Are you sure that you have updated to 16.2.0 successfully?From your error message,You need to check this folder: ..\packages\microsoft.net.test.sdk\16.2.0\build\netcoreapp1.0.Whether it contains Microsoft.NET.Test.Sdk.Program.cs or not.

    jgrandydev

    Microsoft.NET.Test.Sdk v16.0.1 ( I updated to v16.2.0 )
    Microsoft.NET.Test.Sdk v1.3.2 ( I updated to v1.4.0 )
    MSTest.TestFramework v1.3.2 ( I updated to v1.4.0 )

    The correct package should be Microsoft.NET.Test.Sdk(v16.2.0) and MSTest.TestAdapter(v1.4.0) and MSTest.TestFramework(v1.4.0).

    Best Regards,

    Rena

    Thursday, September 5, 2019 3:29 AM