c# - System.MissingMethodException Message=未找到方法 : DryIoc. 规则 DryIoc.Rules.WithoutFastExpressionCompiler()

标签 c# .net prism .net-standard-2.0 dryioc

我正在使用 Prism.DryIoc.Extensions(v8.0.62) 和 Prism.DryIoc.Forms(v8.1.97),它们在内部分别为我的 Xamarin.Forms 项目使用 DryIoc.dll v4.7.3 和 v4.7.7。

我的项目也有一个 nuget 更新,它内部使用 DryIoc.dll v5.0.2。

现在,如果我将项目 nuget 更新到最新版本,它会抛出错误。由于存在版本冲突。

由于这是一个与项目相关的 nuget,我将不得不以某种方式进行更新。但存在对 Prism 的依赖性,并且 Prism 尚未发布任何带有最新 DryIoc.dll 的最新版本。

我尝试在 .csproj 文件中添加以下内容

<PackageReference Include="Prism.DryIoc.Extensions" Version="8.0.62">
        <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
        <dependentAssembly>
          <assemblyIdentity name="DryIoc.dll" culture="neutral" />
          <bindingRedirect oldVersion="4.7.3" newVersion="5.0.2" />
        </dependentAssembly>
    </PackageReference>

这解决了编译时错误,但开始抛出运行时错误,如下所示,

System.MissingMethodException Message=Method not found: DryIoc.Rules DryIoc.Rules.WithoutFastExpressionCompiler()

我还尝试创建 app.config 并使用下面的代码片段,

<configuration>
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="DryIoc" publicKeyToken="dfbf2bd50fcf7768" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.0.1.0" newVersion="5.0.2.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>

但这也会失败,并出现与上面相同的错误。

摆脱 Prism 是解决方案之一,但这是一项巨大的工作,因为整个项目都在使用 Prism。

解决此问题的最佳解决方案是什么?请在这方面帮助我。

最佳答案

Prism 的open source ,您可以修改部分以使用 DryIoc 5 并使用这些 dll。

这并不是说您被迫使用 nuget 包,它们是为了提供帮助。如果它们阻碍了,就摆脱它们。

关于c# - System.MissingMethodException Message=未找到方法 : DryIoc. 规则 DryIoc.Rules.WithoutFastExpressionCompiler(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72257891/

相关文章:

c# - 直接插入或通过存储过程插入

c# - 单击按钮后为我的表选择一个类? (HTML 表格)

.net - '1-dimensional array of byte' 类型的值无法转换为字节

c# - 在 WCF Web 服务客户端中生成 XML 哈希

wpf - 从 MVVM WPF 中的 View 属性组成复杂模型对象(在 View 模型内)的新模型对象[递归]

c# - 在 MVVM 中使用一个 View 对多种类型进行 CRUD

c# - 不能在此范围内声明名为 'e' 的局部变量或参数

.net - 将参数与 EntityFramework 和 `FromSql` 一起使用

wpf - 使用 PRISM 切换主视图

c# - Task.Run 如何避免异步代码中的死锁?