Search code examples
f#com

Using COM from an F# script


How do I use COM libraries from an F# script? Is it even possible? How do I reference the required COM libraries in an .fsx file?

More specifically, I'd like to use InstallShield Automation from a build script. Despite all my efforts, I could only get it to work with a regular compiled project.

Edit: I already tried the COM type provider project. However, it doesn't seem to find any types in the particular COM library I'm interested in. If it's a bug or intended behavior, I don't know.


Solution

  • I think possibly maybe the COM type provider might help you out:

    One advantage of this method is that you can author and deploy F# scripts without having to pre-generate the interop assemblies. Another advantage is that you can easily explore all the COM components installed on your machine via intellisense.

    And yes I did just google it, which OP also might have done before asked here.