4

NUnit2.5.0を使用するSharpArchitectureのテストライブラリの一部を使用していますが、プロジェクトの残りの部分はNUnit 2.5.1を使用しているため、テストプロジェクトアプリの構成ファイルにアセンブリリダイレクトを配置しました。

<?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'

Fusion ErrorLogを有効にすると、次のように表示されます。

=== 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でテストを実行するとすぐに、ファイルが消えます。

誰かが私に何が起こっているのかについての手がかりを与えることができますか?

4

1 に答える 1

1

「.temp」の部分を除いて、クラス ライブラリの App.config をコピーしようとしましたか?

copy $(ProjectDir)App.config $(TargetDir)\$(TargetFileName).config

編集:「*.temp.config」は、TestDriven.NET によって生成されたようです。[stated in the release notes of version 2.3][1]

于 2009-11-17T21:33:21.020 に答える