【问题标题】:FitSharp is not able to find .DLLs in other foldersFitSharp 无法在其他文件夹中找到 .DLL
【发布时间】:2019-04-12 12:11:16
【问题描述】:

我在尝试测试我的应用程序时遇到 System.IO.FileNotFoundException。我的文件夹层次结构如下:

  • 我的 fitSharp 文件夹中有 Runner.exe 和 .dll 的
  • 被测系统在我的调试文件夹中
  • 我有一个对这个 .dll 的引用:!path ........\Debug\XXXXX.dll

所以问题是,因为我正在使用依赖注入 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)

【问题讨论】:

  • 请贴出异常的全文。
  • 见上面的完整例外。谢谢!
  • 删除引用并安装 fitSharp NuGet 包,然后一切都会正常工作。
  • 谢谢,我安装了 NuGet 包。构建我的项目后,只有 DLL 被复制到我的 Debug 文件夹 => 所以我遇到了和以前一样的问题。有没有办法在我的调试文件夹中获取 runner.exe 或者这没有意义?还是我做错了什么?

标签: c# .net fitnesse fitnesse-slim fitsharp


【解决方案1】:

您可以尝试显式加载丢失的 DLL:

!path pathToDll\Microsoft.Practices.Unity.Configuration.dll

或在套件配置文件中尝试以下条目:

<suiteConfig>
    <System.AppDomainSetup>
        <ApplicationBase>pathToSUT</ApplicationBase>
        ...

【讨论】:

    猜你喜欢
    • 2010-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-24
    • 2017-11-18
    • 1970-01-01
    • 2021-02-01
    • 1970-01-01
    相关资源
    最近更新 更多