Nuget package restored but compilation fails - can't find MsTest.TestFramework methods

Lilith River's Avatar

Lilith River

15 Apr, 2020 02:37 PM

I can see that the MsTest.TestFramework package restores successfully: https://ci.appveyor.com/project/imazen/imageflow-dotnet#L119

But compilation still fails: https://ci.appveyor.com/project/imazen/imageflow-dotnet#L173

         TestDotNetClassicLibraryLoading.cs(2,17): error CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\projects\imageflow-dotnet\tests\Imageflow.TestDotNetFull\Imageflow.TestDotNetFull.csproj]
         TestDotNetClassicLibraryLoading.cs(6,6): error CS0246: The type or namespace name 'TestClassAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:\projects\imageflow-dotnet\tests\Imageflow.TestDotNetFull\Imageflow.TestDotNetFull.csproj]
         TestDotNetClassicLibraryLoading.cs(6,6): error CS0246: The type or namespace name 'TestClass' could not be found (are you missing a using directive or an assembly reference?) [C:\projects\imageflow-dotnet\tests\Imageflow.TestDotNetFull\Imageflow.TestDotNetFull.csproj]
         TestDotNetClassicLibraryLoading.cs(9,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:\projects\imageflow-dotnet\tests\Imageflow.TestDotNetFull\Imageflow.TestDotNetFull.csproj]
         TestDotNetClassicLibraryLoading.cs(9,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?) [C:\projects\imageflow-dotnet\tests\Imageflow.TestDotNetFull\Imageflow.TestDotNetFull.csproj]

I recently switched from the Visual Studio 2017 to Visual Studio 2019 build images.

  1. Support Staff 1 Posted by Feodor Fitsner on 15 Apr, 2020 05:34 PM

    Feodor Fitsner's Avatar

    Hi Lilith,

    The library is getting restored, yes: https://ci.appveyor.com/project/FeodorFitsner/imageflow-dotnet#L138

    However, looking at csc.exe command line for test project I don't see it references MSTest assemblies. Is it supposed to pull them via this Import? Try adding those refs directly to the project? Also, you can play with the solution via RDP.

  2. 2 Posted by Lilith River on 16 Apr, 2020 01:04 PM

    Lilith River's Avatar

    I've tried removing and re-adding the nuget references but nothing changes in the .csproj after they are re-added. I'm using packages.config format because ProjectReference doesn't work with native binaries well for .NET full.

  3. 3 Posted by Lilith River on 16 Apr, 2020 01:05 PM

    Lilith River's Avatar

    I can't reproduce this locally, even deleting the packages folder and using VS2019. I will try RDP

  4. 4 Posted by Lilith River on 16 Apr, 2020 02:58 PM

    Lilith River's Avatar

    So, the older version of VS2019 on the worker behaved differently from my newer local VS2019, and correctly added the references in the .csproj. I manually copied/pasted them into the .csproj on my end and now it works! I'm guessing it's just yet another newly introduced VS bug. Thanks for your help!

  5. Support Staff 5 Posted by Feodor Fitsner on 16 Apr, 2020 04:24 PM

    Feodor Fitsner's Avatar

    Cool, thanks for the update! :)

  6. Feodor Fitsner closed this discussion on 16 Jun, 2020 09:02 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac