使用F#交互式输入参考错误 [英] Type reference error using F# interactive

查看:109
本文介绍了使用F#交互式输入参考错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a solution consisting of 2 projects:

  • 实用工具-该项目包含类型MyMatlab,并引用COM(TLP)引用Matlab Application (Version 7.11) Type Library

  • Utilities - This project contains type MyMatlab and references a COM (TLP) reference Matlab Application (Version 7.11) Type Library

LBM -该项目包含功能displayMyMatlab,该功能使用Utilities项目中的MyMatlab类型,因此该项目引用了Utilities

LBM - This project contains function displayMyMatlab which uses the MyMatlab type from the Utilities project and thus this project references Utilities

我创建一个包含以下内容的fsx文件:

I create a fsx file containing:

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

是什么意思?当我使用普通的编译项目执行相同操作时,它就可以正常工作.任何帮助表示赞赏!

What does it mean? When I do the same using an ordinary compiled project, it works just fine. Any help appreciated!

推荐答案

Tomas Petricek在这里回答了类似的问题: 将COM DLL与FSI一起使用

Tomas Petricek answered a similar question here: Using COM DLLs with FSI

我猜您需要先引用生成的包装器dll,然后再引用自己的dll.生成的包装程序通常在bin文件夹中名为"Interop.LibName.dll".

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.

这篇关于使用F#交互式输入参考错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆