问题
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!
回答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