gpt4 book ai didi

.net - F# 4.0.0.0 到 4.3.0.0 的系统范围 bindingRedirect

转载 作者:行者123 更新时间:2023-12-04 15:14:03 26 4
gpt4 key购买 nike

我有一些 xUnit 测试失败了

Could not load file or assembly 'FSharp.Core, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
The system cannot find the file specified.

为了执行机器范围的重定向,我添加到文件中
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config 

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a"
culture="neutral"/>
<bindingRedirect oldVersion="4.0.0.0" newVersion="4.3.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>

你有更好的方法来处理 4.0/4.3 问题吗?

最佳答案

我不知道 xUnit,但如果您的单元测试运行程序支持 app.config 文件,您可以将配置附加到单元测试程序集(例如,一个 app.config 与您使用默认 F# 控制台应用程序模板获得的内容相同) )。如果测试运行器不支持 app.config,那么我认为 machine.config 策略是一个不错的策略。

关于.net - F# 4.0.0.0 到 4.3.0.0 的系统范围 bindingRedirect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11718385/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com