Automated F# Signature File (.fsi) Generation
Asked Answered
L

1

10

I am working on a project that has a number of modules that I'd like to apply access control constraints to. I'd also like to have my project contain additional documentation on the type signatures of each function.

I know that I can accomplish both of these tasks very easily via F# signature files. However, my project is large and contains many files, and I need a convenient way of generating a signature file for each one. I have been successful in generating individual signature files via command line compilations using the --sig compiler option, but I am stuck on how to add compiler options to Visual Studio's build routine.

Is there a convenient way, either via VS compilation options, or via some command line script, for me to create an F# signature file for every *.fs file in my project directory?

Thanks.

Leclair answered 17/6, 2014 at 18:13 Comment(0)
F
12

You can tell VS to pass arbitrary flags to the compiler upon build by right clicking on your project in Solution Explorer and clicking "Properties." Under the "Build" tab fill in "Other flags".

Specifying --sig:<Some path> (with support for msbuild-style $(Variable) settings) will auto-generate a single combined .fsi for your library.

enter image description here

Friedlander answered 17/6, 2014 at 21:55 Comment(3)
Thanks. Is it possible to generate separate signature files for each file in the project?Leclair
No, not that I know of.Friedlander
The Visual F# Power Tools has a feature request for this, so we might see it implemented in a not-too-distant future.Fantoccini

© 2022 - 2024 — McMap. All rights reserved.