The FSharp.Compiler.CodeDom library can be installed from NuGet:
PM> Install-Package FSharp.Compiler.CodeDom


The FSharp.Compiler.CodeDom component contains three CodeDom code generators related to F#.

  • FSharpCodeProvider. Generates compilable, correct but messy F# code for as many CodeDom constructs as possible. Suitable for generating code that is never read nor edited by humans.

  • FSharpCleanCodeProvider. Generates clean F# code for a smaller subset of CodeDom constructs. Suitable for generating templates of code that may later be edited by humans.

  • FSharpAspNetCodeProvider. A legacy provider for quirks associated with earlier versions of ASP.NET code.


Please see the tutorial.

Samples & documentation

The library comes with comprehensible documentation. It can include tutorials automatically generated from *.fsx files in the content folder. The API reference is automatically generated from Markdown comments in the library implementation.

  • Tutorial contains a further explanation of this sample library.

  • API Reference contains automatically generated documentation for all types, modules and functions in the library. This includes additional brief samples on using most of the functions.

Contributing and copyright

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding a new public API, please also consider adding samples that can be turned into a documentation. You might also want to read the library design notes to understand how it works.

The library is available under Public Domain license, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.

Fork me on GitHub