.net - 4.6.1 F# 应用程序抛出 FileNotFoundException : FSharp. 核心

标签 .net visual-studio f# nuget

我有一个 .NET4.6.1 项目,如果我链接到 Nuget 的 FSharp.Core 最新版本(在撰写本文时为 4.3.4),则会引发以下异常:

Can't find custom attr constructor image: /Users/andres/Documents/Code/MyApp/src/MyApp/bin/Debug/MyApp.exe mtoken: 0x0a000015 due to: Could not load file or assembly 'FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. assembly:FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a type: member:

奇怪的是,编译后我只在obj文件夹中找到了.dll,而在bin文件夹中却找不到:

$ find ./src | grep FSharp.Core
./src/MyApp/obj/Debug/FSharp.Core.dll

这是预期的吗?我正在使用 VS4Mac。

最佳答案

事实证明,当将 FSharp.Core nuget 依赖项升级到新版本时,.fsproj 文件中发生的真正差异是这样的:

     <Reference Include="FSharp.Core">
-      <HintPath>..\..\packages\FSharp.Core.4.1.0.2\lib\net45\FSharp.Core.dll</HintPath>
+      <HintPath>..\..\packages\FSharp.Core.4.3.4\lib\net45\FSharp.Core.dll</HintPath>
+      <Private>False</Private>
     </Reference>

(但是看到这一点并不清楚,因为它正在将 <Reference> 标签移动到文件中的其他位置。)

请注意添加 <Private>上面的标签。如果你这样做what is advised in this other answer to a similar question (我不会声称它是重复的,因为一个是关于 Windows 的,而这个是 macOS),即将引用标记为 LocalCopy=true,然后 Visual Studio 删除 <Private>False</Private> XML 元素,一切又开始工作。

关于.net - 4.6.1 F# 应用程序抛出 FileNotFoundException : FSharp. 核心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49584528/

相关文章:

f# - 解释器可以用符号表来实现吗?

c# - WCF 的表单例份验证

c# - 如何让WPF UI 的滑动动画更加有形?

visual-studio - 保留以前的 "find all references"结果

c++ - Boost 链接、Visual Studio 和版本控制

performance - 我可以在 F# 中与收集函数并行执行两个求和,或者通常优化整个事情

.net - 使用 WIF 在 .NET Web Farm 中为多个电子商务网站实现 SSO?

.net - 我可以使用 NHibernate 作为与不同数据库引擎通信的标准化方式吗?

c# - Visual Studio Extensibility Package 没有查看正确的项目

f# - 无法在 C# 项目中引用 'FSharpOption<>'