Cannot run any unit tests in Visual Studio 2015

user104

I have recently downloaded Visual Studio 2015 and imported an old project into it. The problem is that now none of the unit tests run, and instead I get the dreaded BadImageFormatException

Unable to get type GameTests.UnitTest1. Error: System.BadImageFormatException: Could not load file or assembly 'file:///C:\Users\...\bin\Debug\GameTests.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
File name: 'file:///C:\Users\...\bin\Debug\GameTests.dll'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Microsoft.VisualStudio.TestPlatform.MSTestFramework.TypeCache.LoadType(String typeName, String assemblyName)

At first I thought that there might have been something wrong when I transferred an existing project to VS2015, but I have tried with a newly created project, and the same happens. I have also tried both MS UnitTestFramework and NUnit. Nothing seems to help.

Any ideas?

P.S. - I've also set the Platform target to x86 and checked that all my projects have the same target framework.

eavidan

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Parameterized Unit Tests with Visual Studio 2015 Intellitest

From Java

Visual Studio 2015 or 2017 does not discover unit tests

From Dev

How do I do unit tests in Visual Studio 2015

From Dev

Visual Studio 2015 not running C++ unit tests

From Dev

Any way to speed up unit testing in Visual Studio 2015 for UWP

From Dev

How to run NUnit tests with Visual Studio 2015 CTP 6?

From Dev

Unit test for UWP app failed to run on Visual Studio 2015

From Dev

Run other project when running unit tests in Visual Studio 2013

From Dev

Tests are not visible by Visual Studio 2015

From Dev

Cannot run Code Analysis Analyzer in Visual Studio 2015

From Dev

OpenCV cannot open video file when run with Visual Studio 2015

From Dev

OpenCV cannot open video file when run with Visual Studio 2015

From Dev

How do I generate "Smart Unit Tests" with Visual Studio 2015 Preview?

From Dev

Why are unit tests greyed out in Visual Studio 2015 for SQL Server project?

From Dev

Unable to run tests in Visual Studio

From Dev

cannot uninstall Visual Studio 2015

From Dev

Do Visual Studio unit tests in a batch run only do static initialization once?

From Dev

Do Visual Studio unit tests in a batch run only do static initialization once?

From Dev

NUnit. No tests detected in Visual Studio 2015

From Java

Visual Studio 15.8.1 not running MS unit tests

From Java

Controlling execution order of unit tests in Visual Studio

From Dev

Unit tests not showing in Visual Studio 2013, and 2012

From Dev

Are there "Dynamic Playlists" of unit tests in Visual Studio?

From Dev

Visual Studio C# Unit Tests

From Dev

Visual Studio 2012 Not Recognizing Existing Unit Tests

From Dev

Are there "Dynamic Playlists" of unit tests in Visual Studio?

From Dev

Run unit tests on Save with Android Studio

From Dev

How to run unit tests with Android Studio

From Dev

attaching unit test data to unit tests in visual studio

Related Related

  1. 1

    Parameterized Unit Tests with Visual Studio 2015 Intellitest

  2. 2

    Visual Studio 2015 or 2017 does not discover unit tests

  3. 3

    How do I do unit tests in Visual Studio 2015

  4. 4

    Visual Studio 2015 not running C++ unit tests

  5. 5

    Any way to speed up unit testing in Visual Studio 2015 for UWP

  6. 6

    How to run NUnit tests with Visual Studio 2015 CTP 6?

  7. 7

    Unit test for UWP app failed to run on Visual Studio 2015

  8. 8

    Run other project when running unit tests in Visual Studio 2013

  9. 9

    Tests are not visible by Visual Studio 2015

  10. 10

    Cannot run Code Analysis Analyzer in Visual Studio 2015

  11. 11

    OpenCV cannot open video file when run with Visual Studio 2015

  12. 12

    OpenCV cannot open video file when run with Visual Studio 2015

  13. 13

    How do I generate "Smart Unit Tests" with Visual Studio 2015 Preview?

  14. 14

    Why are unit tests greyed out in Visual Studio 2015 for SQL Server project?

  15. 15

    Unable to run tests in Visual Studio

  16. 16

    cannot uninstall Visual Studio 2015

  17. 17

    Do Visual Studio unit tests in a batch run only do static initialization once?

  18. 18

    Do Visual Studio unit tests in a batch run only do static initialization once?

  19. 19

    NUnit. No tests detected in Visual Studio 2015

  20. 20

    Visual Studio 15.8.1 not running MS unit tests

  21. 21

    Controlling execution order of unit tests in Visual Studio

  22. 22

    Unit tests not showing in Visual Studio 2013, and 2012

  23. 23

    Are there "Dynamic Playlists" of unit tests in Visual Studio?

  24. 24

    Visual Studio C# Unit Tests

  25. 25

    Visual Studio 2012 Not Recognizing Existing Unit Tests

  26. 26

    Are there "Dynamic Playlists" of unit tests in Visual Studio?

  27. 27

    Run unit tests on Save with Android Studio

  28. 28

    How to run unit tests with Android Studio

  29. 29

    attaching unit test data to unit tests in visual studio

HotTag

Archive