How to change ReSharper unit test architecture to x64?

后端 未结 7 1406
温柔的废话
温柔的废话 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:41

    When working with high memory code you may find you need to alter the R# test runner config to include

    <runtime>
        <gcAllowVeryLargeObjects enabled="true" />
    </runtime>
    

    You can find this file located at

    %localappdata%\JetBrains\Installations\ReSharperPlatformVs12\
    JetBrains.ReSharper.TaskRunner.CLR45.x64.exe.config
    

    This path is likely dependudant upon Visual Studio version and may vary upon R# version. This specific path is Visual Studio 2013 with Resharper 9.1. Recurrent issue with Resharper 10. Location of config file is unchanged. https://youtrack.jetbrains.com/issue/RSRP-446178

    0 讨论(0)
  • 2021-02-08 22:44

    My solution is too hacky, but thats the only thing which worked for me

    I placed a copy of vstest.executionengine.x86.exe for backup and placed a renamed vstest.executionengine.exe (64bit version) instead of old 32 bit version.

    0 讨论(0)
  • 2021-02-08 22:44

    With, Visual Studio 2015, I've found that both x86 and x64 settings will cause this. The solution was to close and restart Visual Studio.

    0 讨论(0)
  • 2021-02-08 22:46

    I tried different things that I found in Google and on StackOverflow (including other answers in this topic), but what worked for me is:

    ReSharper's Unit Test Sessions window -> on the top panel set Platform dropdown to 64-bit.

    0 讨论(0)
  • 2021-02-08 22:48

    I just ran into this with ReSharper and MsTests - error "unit test runner failed to run tests incompatible target platform".

    Our issue was that the test project wasn't being built.

    To fix:

    1. Build

    2. Configuration Manager

    3. Confirm that Build is ticked.

    Switch between your Solution Configurations to confirm it's being built in all configurations.

    0 讨论(0)
  • 2021-02-08 22:54

    We had a similar issue when trying to setup MSTEST for Sharepoint 2007 - it would keep running in x86 instead of x64. Instantiating SPSite kept saying "The Web application at http://server:port/ could not be found".

    Option 1 - Assign Proper Active TestSettings

    I started with replacing the EXEs suggested by @valentin-kuzub to confirm it would work - but then realized that we had the wrong Test Settings file active - there were (2) Local.testsettings and TraceAndTestImpact.testsettings. One of them was set to use x86 instead of targeting x64.

    Option 2 - Configure RunSettings

    Another option is switching from testSettings to runSettings and assigning TargetPlatform.

    <RunSettings>
      <!-- Configurations that affect the Test Framework -->
      <RunConfiguration>  
        <!-- [x86] | x64 - You can also change it from menu Test, Test Settings, Default Processor Architecture -->
        <TargetPlatform>x64</TargetPlatform>
        <!-- Framework35 | [Framework40] | Framework45 -->
        <TargetFrameworkVersion>Framework40</TargetFrameworkVersion>
      </RunConfiguration>
    

    Option 3 - Use Test Settings Default Architecture

    The last option (which you already tried) is in the XML comments from option #2 -> You can also change it from menu Test->Test Settings->Default Processor Architecture->x64.

    enter image description here

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