How do I get unit tests to run on a x64 platform

前端 未结 6 723
自闭症患者
自闭症患者 2020-12-14 14:20

I have a C# application that must run in x64 mode. The problem is I try to create unit tests that run methods in the x64 application and the unit test project won\'t even b

相关标签:
6条回答
  • 2020-12-14 14:32

    I have had the same issue, Add App.config file

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    </configuration>
    
    0 讨论(0)
  • 2020-12-14 14:35

    In VS 2012 and above you can select the default target platform from Test menu under Test Settings|Default Processor Architecture

    0 讨论(0)
  • 2020-12-14 14:41

    This error can be fixed if you clean and rebuild all of the relevant assemblies. There must be one file corrupted unexpectedly.

    One thing for VS to improve, is when the bad format exception is detected, please report the file name. Then the developer can only rebuild that file.

    0 讨论(0)
  • 2020-12-14 14:42

    I had a similar issue. There is a strange issue in Visual Studio 2010 (under x64), which causes the target CPU to be changed when you add a new project to the existing solution. Are you sure that all references and CPU targets are x64?

    0 讨论(0)
  • 2020-12-14 14:45

    I'm assuming that you are using Visual Studios testing framework since you mention no other. In VS2010 you can force the testing host to run in x64. Build your assemblies as Any CPU or x64 then set the test host to x64.

    http://msdn.microsoft.com/en-us/library/ee782531.aspx

    0 讨论(0)
  • 2020-12-14 14:46

    You will need to set all references of the test project to local (set to true). I got this problem before, hope that it will work for you too (I'm using windows 7 64 bit + VS2012)

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