我正在使用 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/