I am writing tests for an application using Outlook Redemption that absolutely must run 64-bit (it connects to windows MAPI and Outlook x64). Unfortunately, I cannot for the life of me make it run the test in 64-bit. I have tried using a .runsettings
file (edited to indicate 64-bit) and a .testsettings
file (also edited), and finally I have selected Test>TestSettings>Default Processor Architecture>64-bit
, to no avail.
Every time, System.Environment.Is64BitProcess is false, and when I load the dll to connect to Outlook and MAPI I get the dreaded COM Exception: Wrong OS or OS version for application (Exception from HRESULT: 0x800401FA (CO_E_WRONGOSFORAPP))
which indicates that 64-bit Outlook is installed and the process trying to access it is 32-bit.
I have restarted VS 2012 after making settings changes as I have read somewhere that a restart may be necessary. Does anyone have any other suggestions? I could just write this as a console app that runs informal tests and reports their status, but my next step is to get these tests integrated into the automated build. Any help would be greatly appreciated.
Screenshot of Host Settings page in .testsettings
Interestingly, I did a little experiment. I created a new solution with a single console app project. I put a public method in there that just returned true. When I ran the console app, and paused execution, I looked and indeed it is running 64-bit; no problem there. I then added a test project, created a single test which called the method. I also added var is64 = Environment.Is64bitProcess
and put a breakpoint after it.
Predictably, without changing any options, is64 was false. I chose the 64-bit default architecture from the dropdown under test, then cleaned the solution, and ran the test again, same result, running 32-bit. I restarted VS2012, cleaned, built, same result. I created a testsettings file and referenced it in the Test menu, clean build, same, restart,clean, build same. I created a runsettings file, set <TargetPlatform>x64</TargetPlatform>
, referenced that in the test menu, ran through it all again, and came up with the same results. QTAgent32.exe continues to run the process, and absolutely refuses to heed my demands that it run 64 bit.
I swear, if I have to delete QTAgent32.exe and rename QTAgent to that name, I will. I am not above cramming my wishes down the computers throat when it wants to be obstinate. Please, if you dont want to see me mistreat a workstation, someone show me what is going wrong. Think of the computers.
If you use VS2012, then you will be able to select your platform x64 through test settings as below;
In this example I am referring to .runsettings file. the settings are
But if wish to run your test through command line you need to use vstest.console.exe instead of MSTEST as it doesn't support for x64 test.dlls
you will find vstest.console.exe at "C:\Program Files (x86)\Common7\IDE\CommonExtensions\Microsoft\TestWindow\"
Please note below steps
Note : Test.Automation.Specs.dll is your test project and you need to define full path
I hope this help
I ran into the same issue just now. Here are the steps you can follow to fix the problem.
References
This is a bit out of my scope, but the configuration settings for both projects are set correctly, right? You have them set to build for AnyCPU or x64?
Just trying to Occam's Razor it out... I know I've been frustrated too many times by configuration settings that VS just magically decides to change on me.
User contributions licensed under CC BY-SA 3.0