How to change ReSharper unit test architecture to x64?

后端 未结 7 1422
温柔的废话
温柔的废话 2021-02-08 22:21

In VS2012, I resolved a BadImageException from running a unit test by going to: TEST-> TEST SETTINGS -> DEFAULT PROCESSOR ARCHITECTURE -> x64.

This works in the built in

相关标签:
7条回答
  • 2021-02-08 22:57

    ReSharper will run tests with the bit-ness of the test project. So if your test project is AnyCpu, it will run in an AnyCpu host process, which means 32bit on a 32bit system or 64bit on a 64bit system. If you set your project to be 32bit or 64bit specific, ReSharper will run it in a 32bit or 64bit host process.

    So, if your production code is 32 bit specific, you should make your test project 32 bit specific, too. If your production code is 64 bit specific, it should work fine, as long as your test project is 64 bit or AnyCpu.

    Similarly, it will use the .net runtime of the test project - .net 2 or .net 4.

    These defaults work for the vast majority of cases. I've never had to set it manually, but you can override this behaviour, and force a bit-ness or .net framework version. ReSharper 8 has these settings in the Options dialog (Options -> Tools -> Unit Testing). If you set this when a solution is open, it sets it for the current solution. If there isn't a solution open, it becomes the default for all solutions. You can also set this on a per-test run basis in the unit test sessions window. This setting doesn't persist.

    0 讨论(0)
提交回复
热议问题