System.BadImageFormatException caused by NUnit project

前端 未结 10 1169
孤城傲影
孤城傲影 2020-12-10 02:03

Good day everyone. I have been having the same problem all day at work and am struggling to find any new paths to go down.

I am getting the following error when my

相关标签:
10条回答
  • 2020-12-10 02:33

    Thanks Ashes999 for waking me up.

    This problem did return again. And rolling back and uploading with didn't work. It turned out to be a monitor object which we no longer even use. Commented out and fixed.

    The way to find this is by doing Debug All Unit Tests. Fix everywhere it pauses. If t doesn't pause then err.

    0 讨论(0)
  • 2020-12-10 02:34

    For me, the exception was caused by invalid /process=single argument of nunit. If I change the value, then the exception is gone:

    /process=separate
    

    or

    /process=multiple
    

    p/s: late answer, but just for reference..

    0 讨论(0)
  • 2020-12-10 02:36

    For anyone still having this issue, you also may need to set the framework field on the test runner to match the one in your included project (The field just to the right of the one referenced by AlexM).

    In my case, I was writing a test suite for a Windows Phone 8 library, and NUnit was unable to correctly figure out the framework version that it should use.

    0 讨论(0)
  • 2020-12-10 02:40

    I come across this often, when I test against Console or WPF application. A few causes are

    • First, make sure you application doesn't run on .Net Framework 3 or 4 Client profile
    • Then compare the target framework .NET version on both application and test projects. They should be the same
    • Check Platform target on build tab. They should be the same. For example, if test project has "Any CPU" target, the application must have "Any CPU".
    0 讨论(0)
提交回复
热议问题