我有两个程序集:1.带有功能文件的 AcceptanceTests 2.带有步骤定义的 AccountAbstractSteps
AcceptanceTests 有对 AccountAbstractSteps 的引用(复制本地 = true),并且在 AcceptanceTests app.config 我有
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
</configSections>
<specFlow>
<unitTestProvider name="MsTest.2010" />
<stepAssemblies>
<stepAssembly assembly="AccountAbstractSteps" />
</stepAssemblies>
</specFlow>
<appSettings>
<add key="homeUrl" value="http://localhost:1338" />
</appSettings>
</configuration>
在 resharper 更新后,所有测试都失败并显示消息
Class Initialization method AcceptanceTests.Features.MyFeature.FeatureSetup threw exception. System.IO.FileNotFoundException: System.IO.FileNotFoundException: Could not load file or assembly 'AccountAbstractSteps' or one of its dependencies. The system cannot find the file specified.=== Pre-bind state information ===
LOG: User = mycomp\myuser
LOG: DisplayName = AccountAbstractSteps
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: AccountAbstractSteps | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = mypath/Source Code/TestResults/comp 2012-12-29 13_35_22/Out
LOG: Initial PrivatePath = NULL
Calling assembly : TechTalk.SpecFlow, Version=1.9.0.77, Culture=neutral, PublicKeyToken=0778194805d6db41.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: mypath\TestResults\comp 2012-12-29 13_35_22\Out\AcceptanceTests.DLL.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\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 mypath/TestResults/comp 2012-12-29 13_35_22/Out/AccountAbstractSteps.DLL.
LOG: Attempting download of new URL mypath/TestResults/comp 2012-12-29 13_35_22/Out/AccountAbstractSteps/AccountAbstactSteps.DLL.
LOG: Attempting download of new URL mypath/TestResults/comp 2012-12-29 13_35_22/Out/AccountAbstractSteps.EXE.
LOG: Attempting download of new URL mypath/TestResults/comp 2012-12-29 13_35_22/Out/AccountAbstractSteps/AccountAbstactSteps.EXE.
.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, ref StackCrawlMark stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, ref StackCrawlMark stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, ref StackCrawlMark stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, ref StackCrawlMark stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, ref StackCrawlMark stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at TechTalk.SpecFlow.Infrastructure.BindingAssemblyLoader.Load(String assemblyName)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at TechTalk.SpecFlow.Infrastructure.TestRunnerFactory.Create(Assembly testAssembly)
at TechTalk.SpecFlow.TestRunnerManager.CreateTestRunner(TestRunnerKey key)
at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(TestRunnerKey key)
at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(Assembly testAssembly, Boolean async)
at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner()
at AcceptanceTests.Features.Home.MyFeature.FeatureSetup(TestContext testContext) in MyFeature.feature.cs: line 0