我让System.IO.FileNotFoundException试着测试我的应用程序。我的文件夹层次结构如下:
所以问题是,由于我使用的是依赖注入,所以fitSharp无法找到统一所需的.dll。我总是得到FileNotFound异常。
问题是,如果我将所有文件(.dll)复制到fitSharp文件夹( Runner.exe所在的地方),测试就会正常工作。
问题是,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)发布于 2019-04-25 15:32:19
您可以尝试显式加载缺少的DLL:
!path pathToDll\Microsoft.Practices.Unity.Configuration.dll或者在套件配置文件中尝试这个条目:
<suiteConfig>
<System.AppDomainSetup>
<ApplicationBase>pathToSUT</ApplicationBase>
...https://stackoverflow.com/questions/55651339
复制相似问题