Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS Tests do not match framework settings

I am attempting to move a solution from TFS 2012 to TFS 2018 SP2RC2 but I can't get the unit tests to run correctly. All projects have been re-targeted to 4.7.1 and are built as x86 platform. We have a testsettings file that supplies nothing but deployment items. I am using the new VSTest Platform Installer task (as directed by MS) and the VS Test Task. At the start of the test run I get the following message:

Test run will use DLL(s) built for framework .NETFramework,Version=v4.5 and platform X86. Following DLL(s) do not match framework/platform settings. 

So all of the test are skipped as they target 4.7.1. Where is this 4.5 setting coming from? I cannot find it specified anywhere and can't figure out how to change it.

like image 211
Sam Avatar asked May 07 '18 22:05

Sam


2 Answers

There is a /Framework: parameter that you can specify to VSTest.

In your case, you should specify /Framework:.NETFramework,Version=v4.7.1

See more at https://msdn.microsoft.com/en-us/library/jj155796.aspx?f=255&mspperror=-2147217396

like image 116
Psddp Avatar answered Sep 23 '22 09:09

Psddp


The fix I found for this in Visual Studio is way easier than I thought:

  1. Exit all instances of VS
  2. Open your project folder in Windows Explorer, find the .vs folder, delete it
  3. Restart VS, the folder rebuilds itself, tests work again.

Apparently there are some settings that the NUnit plugin stashes in this folder and they are in binary so you can't edit them. This happened to me after I updated to NUnit3TestAdapter version 3.17.

like image 32
Dennis Bodine Avatar answered Sep 23 '22 09:09

Dennis Bodine