Type reference error using F# interactive

2019-07-30 01:44发布

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条回答
Fickle 薄情
2楼-- · 2019-07-30 02:14

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.

查看更多
登录 后发表回答