使用 F# 交互的类型引用错误
我有一个由 2 个项目组成的解决方案:
Utilities - 该项目包含类型
MyMatlab
并引用 COM (TLP) 参考Matlab 应用程序(版本 7.11)类型库
LBM - 该项目包含函数
displayMyMatlab
,它使用Utilities 中的
项目,因此该项目引用MyMatlab
类型Utilities
我创建了一个 fsx
文件,其中包含:
#r @".\bin\Release\LBM.dll"
#r @".\bin\Release\Utilities.dll"
LBM.displayMyMatlab()
我收到以下错误:
Microsoft (R) F# 2.0 Interactive build 4.0.30319.1
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
>
--> Referenced 'D:\Olda\Bak\Projects\LBM\OldaConsortium\bin\Release\LBM.dll'
--> Referenced 'D:\Olda\Bak\Projects\LBM\OldaConsortium\bin\Release\Utilities.dll'
Lars_Slump_Post.fsx(45,21): error FS0074: The type referenced through 'Utilities.Matlab' is defined in an assembly that is not referenced. You must add a reference to assembly 'Utilities'.
>
这是什么意思?当我使用普通的编译项目执行相同操作时,它工作得很好。任何帮助表示赞赏!
I have a solution consisting of 2 projects:
Utilities - This project contains type
MyMatlab
and references a COM (TLP) referenceMatlab Application (Version 7.11) Type Library
LBM - This project contains function
displayMyMatlab
which uses theMyMatlab
type from theUtilities
project and thus this project referencesUtilities
I create a fsx
file containing:
#r @".\bin\Release\LBM.dll"
#r @".\bin\Release\Utilities.dll"
LBM.displayMyMatlab()
and I get following error:
Microsoft (R) F# 2.0 Interactive build 4.0.30319.1
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
>
--> Referenced 'D:\Olda\Bak\Projects\LBM\OldaConsortium\bin\Release\LBM.dll'
--> Referenced 'D:\Olda\Bak\Projects\LBM\OldaConsortium\bin\Release\Utilities.dll'
Lars_Slump_Post.fsx(45,21): error FS0074: The type referenced through 'Utilities.Matlab' is defined in an assembly that is not referenced. You must add a reference to assembly 'Utilities'.
>
What does it mean? When I do the same using an ordinary compiled project, it works just fine. Any help appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Tomas Petricek 在这里回答了类似的问题:
将 COM DLL 与 FSI 结合使用
我猜您需要先引用生成的包装器 dll引用你自己的dll。生成的包装器通常在 bin 文件夹中命名为“Interop.LibName.dll”。
Tomas Petricek answered a similar question here:
Using COM DLLs with FSI
I'm guessing you need to reference the generated wrapper dll before referencing your own dlls. The generated wrapper is normally named 'Interop.LibName.dll', in your bin folder.