MSTest.exe is failing unit test on MEF Open Generics after upgrading to .net framework 4.6.1

时间:2016-07-11 22:02:11

标签: c# .net visual-studio-2015 mstest mef

After upgrading our project to .net 4.6.1, some of the unit test written for MEF Open Generics turned red when they are run using mstest.exe that shipped with visual studio 2015. After further investigation I found that the Open Generics types are not getting registered in the mef catalog. Same test used run fine with vs2015 mstest before upgrading projects to .net 4.6.1.

The problem is only with mstest.exe. The same test runs fine if I run them using visual studio test. runner(vstest.console.exe). Alsohe Open Generics types are properly registered when application is launched.

I tried using .runsettings file with Framework45 value and the tests run green. When TargetFrameworkVersion is not specified I believe the mstest is falling back to .net 40 where mef open generics were not supported.

the .runsettings file was not needed when projects were on 4.5. It seems there is some issue with mstest.exe shipped with vs2015. I tried vs2015 update 3 and the issue still exists. Does anyone know work around other than using .runsettings

0 个答案:

没有答案