Type reference error using F# interactive

谁都会走 提交于 2019-12-13 17:42:17

问题


I have a solution consisting of 2 projects:

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

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

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!


回答1:


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.



来源:https://stackoverflow.com/questions/6408015/type-reference-error-using-f-interactive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!