4
我使用了一些來自夏普架構測試庫,這使得使用NUnit 2.5.0的,而我的項目的其餘部分使用NUnit的2.5.1所以我把組裝重定向在我的測試項目中的應用程序配置文件:問題重定向NUnit的程序集版本(什麼是[的AssemblyName] .temp.config?)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding>
<dependentAssembly>
<assemblyIdentity name="nunit.framework"
publicKeyToken="96d09a1eb7f44a77" />
<bindingRedirect oldVersion="2.5.0.9122"
newVersion="2.5.1.9189"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
我仍然得到一個裝配重定向版本:
TestCase ''
failed: Could not load file or assembly 'nunit.framework, Version=2.5.0.9122, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
System.IO.FileLoadException: Could not load file or assembly 'nunit.framework, Version=2.5.0.9122, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'nunit.framework, Version=2.5.0.9122, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77'
啓用我的融合錯誤日誌我看到這一點:
=== Pre-bind state information ===
LOG: DisplayName = nunit.framework, Version=2.5.0.9122, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77
(Fully-specified)
LOG: Appbase = file:///C:/code/Samples/PersistencePatterns/app/PersistencePatterns.Tests/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : SharpArch.Testing.NUnit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b5f559ae0ac4e006.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\code\Samples\PersistencePatterns\app\PersistencePatterns.Tests\bin\Debug\PersistencePatterns.Tests.dll.temp.config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: nunit.framework, Version=2.5.0.9122, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77
LOG: Attempting download of new URL file:///C:/code/Samples/PersistencePatterns/app/PersistencePatterns.Tests/bin/Debug/nunit.framework.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
什麼給?它尋找的這個temp.config文件是什麼?爲什麼它不在我的實際配置中查找?
那麼不管,我增加了以下我後期生成事件:
copy $(ProjectDir)App.config $(TargetDir)\$(TargetFileName).temp.config
一切都被複制很好,但只要我跑測試與Testdriven.NET文件消失。
任何人都可以給我一個線索,知道怎麼回事?
這就是Visual Studio中做了。我已經驗證過,由於某種原因,通過檢查文件是否存在,此功能不會中斷。儘管如此,我從來沒有見過這樣的臨時擴展。 – 2009-11-18 17:49:21
你說得對,我確信它只會爲可執行文件而不是類庫執行此操作。我的錯。正如2.3版本的發行說明(http://www.testdriven.net/downloads/ReleaseNotes.html)所述,「* .temp.config」似乎是由TestDriven.NET生成的。 – 2009-11-18 18:05:53