私は参照されている を持っていUnitTests.dll
ますCommon.dll
(どちらも VS2015 でビルドされています)。
次のディレクトリ構造があります。
C:\Test\
- UnitTests.dll
- UnitTests.runsettings
C:\Bin\
- Common.dll
UnitTests.runsettings
内容は次のとおりです。
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<TargetPlatform>x64</TargetPlatform>
</RunConfiguration>
<MSTest>
<MapInconclusiveToFailed>True</MapInconclusiveToFailed>
<CaptureTraceOutput>False</CaptureTraceOutput>
<DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>
<DeploymentEnabled>False</DeploymentEnabled>
<AssemblyResolution>
<Directory Path="C:\Bin\" includeSubDirectories="true" />
</AssemblyResolution>
</MSTest>
</RunSettings>
テストを呼び出します。
C:\Test> vstest.console.exe UnitTests.dll /settings:UnitTests.runsettings /inIsolation
vstest.console.exe
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe を指します。
次のエラーが表示されます。
Starting test execution, please wait...
Failed TestMethod1
Error Message:
Test method UnitTests.UnitTest1.TestMethod1 threw exception: System.IO.FileNotFoundException: Could not load file or assembly 'Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Stack Trace:
at UnitTests.UnitTest1.TestMethod1()
さらに、Fusion Log を有効にした場合:
Starting test execution, please wait...
Failed TestMethod1
Error Message:
Test method UnitTests.UnitTest1.TestMethod1 threw exception: System.IO.FileNotFoundException: Could not load file or assembly 'Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
=== Pre-bind state information ===
LOG: DisplayName = Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Test
LOG: Initial PrivatePath = NULL
Calling assembly : UnitTests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
=== LOG: This bind starts in default load context.
LOG: Using application configuration file:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.executionengine.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Test/Common.DLL.
LOG: Attempting download of new URL file:///C:/Test/Common/Common.DLL.
LOG: Attempting download of new URL file:///C:/Test/Common.EXE.
LOG: Attempting download of new URL file:///C:/Test/Common/Common.EXE.
Stack Trace:
at UnitTests.UnitTest1.TestMethod1()
ある種のキャッシングの問題に直面していますか? vstest.console.exe
内部の依存関係を探すように説得するにはどうすればよいですかC:\Bin\
(理論的に要素によって指摘されているようにAssemblyResolution
)?
アップデート:
接続時にバグとして MSFT に送信されました (再現手順 - 下部の [詳細] タブの下)。
アセンブリ解決の既存の制限、および属性の使用の強制は、DeploymentItem
まったくスケーリングしません。冗長なメンテナンス コスト (開発者が、単体テストを実行するために必要な依存関係を手動で追跡する必要がある場合) は、テストに摩擦をもたらします。その摩擦の結果として現れる問題は、トラブルシューティングが非常に困難です。