我在尝试测试我的应用程序时遇到System.IO.FileNotFoundException。我的文件夹层次结构如下:
所以问题是,当我使用Dependecy Injection时,fitSharp无法找到所需的.dll以保持一致。我一直都在收到FileNotFound Exception。
问题是,如果我将所有文件(.dll)复制到Runner.exe所在的fitSharp文件夹中,则测试工作正常。
问题是,fitsharp无法在其他文件夹中找到文件,我也不知道如何提供该路径到fitSharp。
我已经尝试使用configuration.xml文件声明所有需要的DLL,但仍然没有。
__ EXCEPTION __:System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> XXXException: Verbindung fehlgeschlagen. DatabaseException (0x80004005): Failed to execute non query ---> System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for unity: Could not load file or assembly 'Microsoft.Practices.Unity.Configuration' or one of its dependencies. Das System kann die angegebene Datei nicht finden. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Practices.Unity.Configuration' or one of its dependencies. Das System kann die angegebene Datei nicht finden. at System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError) at System.Configuration.MgmtConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord) at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere) at fitSharp.Machine.Model.TypedValue.ThrowExceptionIfNotValid() at fitSharp.Slim.Operators.InvokeInstructionBase.InvokeMember(Tree1 parameters, Int32 memberIndex)
at fitSharp.Slim.Operators.ExecuteCall.ExecuteOperation(Tree1 parameters) at fitSharp.Slim.Operators.InvokeInstructionBase.Invoke(TypedValue instance, MemberName memberName, Tree`1 parameters)
答案 0 :(得分:1)
您可以尝试显式加载缺少的DLL:
!path pathToDll\Microsoft.Practices.Unity.Configuration.dll
或在套件配置文件中尝试以下条目:
<suiteConfig>
<System.AppDomainSetup>
<ApplicationBase>pathToSUT</ApplicationBase>
...