简体   繁体   English

在哪里告诉 F# 编译器定位程序集?

[英]Where to tell the F# compiler to locate an assembly?

I'm trying to compile an F# program that wants to use arbitrary precision rational numbers.我正在尝试编译一个想要使用任意精度有理数的 F# 程序。 The source code contains源代码包含

open MathNet.Numerics

and MathNet.Numerics and MathNet.Numerics.FSharp are installed in such a way that Visual Studio is happy. MathNet.Numerics 和 MathNet.Numerics.FSharp 的安装方式让 Visual Studio 满意。 Now I'm trying to compile the program from the command line using fsc directly (in order to have more control over what's going on).现在我正在尝试直接使用 fsc 从命令行编译程序(以便更好地控制正在发生的事情)。 Clearly, the compiler needs to be told about the referenced assembly.显然,需要告知编译器有关引用程序集的信息。

I've tried我试过了

fsc -r:MathNet.Numerics ...

but it says但它说

error FS0082: Could not resolve this reference.错误 FS0082:无法解析此引用。 Could not locate the assembly "MathNet.Numerics".找不到程序集“MathNet.Numerics”。 Check to make sure the assembly exists on disk.检查以确保程序集存在于磁盘上。 If this reference is required by your code, you may get compilation errors.如果您的代码需要此引用,您可能会遇到编译错误。 (Code=MSB3245) (代码=MSB3245)

Presumably I need to use some other option that tells fsc where to look for the assembly in question.大概我需要使用一些其他选项来告诉 fsc在哪里寻找有问题的程序集。 Which option should I use, and what location should I supply?我应该使用哪个选项,我应该提供什么位置? (There are quite a few copies of various versions of MathNet.Numerics.dll on the machine; it's not clear which should be regarded as canonical for this purpose.) (机器上有很多不同版本的 MathNet.Numerics.dll;目前尚不清楚哪个版本应被视为规范。)

You can specify the full path to the assembly with -r , not just the file name.您可以使用-r指定程序集的完整路径,而不仅仅是文件名。 For me, it looks like this:对我来说,它看起来像这样:

-r:C:\Users\MyName\.nuget\packages\mathnet.numerics\4.15.0\lib\netstandard2.0\MathNet.Numerics.dll

Alternatively, you can use -I:folder-name to specify a directory to be searched for assemblies that are referenced.或者,您可以使用-I:folder-name指定要搜索的目录以查找引用的程序集。

These compiler options are documented here .这些编译器选项记录在此处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM