【问题标题】:Type reference error using F# interactive使用 F# 交互式类型引用错误
【发布时间】:2011-06-20 07:24:48
【问题描述】:

我有一个由 2 个项目组成的解决方案:

  • 实用程序 - 此项目包含类型 MyMatlab 并引用 COM (TLP) 引用 Matlab Application (Version 7.11) Type Library

  • 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'.
> 

这是什么意思?当我使用普通的编译项目做同样的事情时,它工作得很好。任何帮助表示赞赏!

【问题讨论】:

    标签: matlab f# reference assemblies f#-interactive


    【解决方案1】:

    Tomas Petricek 在这里回答了类似的问题: Using COM DLLs with FSI

    我猜你需要在引用自己的 dll 之前引用生成的包装器 dll。生成的包装器通常在您的 bin 文件夹中命名为“Interop.LibName.dll”。

    【讨论】:

    • @Oldrich Svec - 您是否尝试过反转引用,即先是实用程序,然后是 LBM?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-14
    • 1970-01-01
    • 2016-04-01
    • 1970-01-01
    • 2018-04-15
    相关资源
    最近更新 更多