4
我安裝了NUnit 2.6.1並嘗試在Windows 7 x64上運行一個簡單的測試。它導致異常無法運行NUnit測試
嘗試加載格式不正確的程序。您 可能會嘗試加載使用CLR的更高版本的 版本構建的程序集,而不是NUnit當前運行的版本 (2.0.50727)或嘗試將64位程序集加載到32位進程中。
這是很奇怪,因爲nunit.exe.config
看起來像下面
<?xml version="1.0" encoding="utf-8" ?>
- <configuration>
- <!--
The GUI only runs under .NET 2.0 or higher. The
useLegacyV2RuntimeActivationPolicy setting only
applies under .NET 4.0 and permits use of mixed
mode assemblies, which would otherwise not load
correctly.
-->
- <startup useLegacyV2RuntimeActivationPolicy="true">
- <!-- Comment out the next line to force use of .NET 4.0
-->
- <!-- <supportedRuntime version="v2.0.50727" />
-->
<supportedRuntime version="v4.0.30319" />
</startup>
- <runtime>
- <!-- Ensure that test exceptions don't crash NUnit
-->
<legacyUnhandledExceptionPolicy enabled="1" />
- <!-- Run partial trust V2 assemblies in full trust under .NET 4.0
-->
<loadFromRemoteSources enabled="true" />
- <!-- Look for addins in the addins directory for now
-->
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib;addins" />
</assemblyBinding>
</runtime>
</configuration>
不理解你。 NUnit是64位,對吧?我的系統也是64位,我需要測試的程序也是64位。問題在哪裏? – Alexandre
問題是你正在構建64位DLL,但在32位模式下運行NUnit。你確定你正在運行64位的NUnit嗎?有一個單獨的64位可執行文件。或者你是這樣做的,你正在運行64位的NUnit並加載32位的DLL。無論哪種方式是不匹配的,它不高興 – devshorts
不,我不是。我如何在64模式下運行它(NUnit)? 「或者你是這樣做的,你正在運行64位的NUnit並加載32位的dll。」其實,我不知道。我怎麼知道它? – Alexandre