A prototypical F# library (file system layout and tooling), recommended by the F# Software Foundation.
This scaffolding can be used to generate the suggested structure of a typical F# library. (NOTE: this layout needs adjusting when authoring a Type Provider. In that case you should use a separate Tests solution)
Area | Technologies |
---|---|
Platforms | Linux, Windows, OSX |
Build Automation | FAKE |
Unit Testing | NUnit |
Package Formats | Nuget packages |
Documentation Authoring | Markdown, HTML and F# Literate Scripts |
Source Code Linking | SourceLink |
Continuous Build and Test | Travis (Linux/OSX) and AppVeyor (Windows) |
Default Package Hosting | nuget.org |
Default Documentation Hosting | GitHub Pages |
Run
./build.sh
or
./build.cmd
You will be prompted for the name of your project and some other details. The project structure will then be generated from templates.
After initialization, you can
- Open, edit, build and test using
ProjectName.sln
- Build and test release binaries using
build.cmd
orbuild.sh
- Build and test release packages using
build.cmd Release
orbuild.sh Release
- Build and publish release docs using
build.cmd ReleaseDocs
orbuild.sh ReleaseDocs
- Add assets to the GitHub releases (Look into the Release target in
build.fsx
) - Publish packages using
build.cmd Release
orbuild.sh Release
(and specify the NugetAccessKey)
Folder | Description |
---|---|
.nuget |
These files are used to get NuGet dependencies on a clean build and for other NuGet-related tasks including Visual Studio Package Restore. Do not put anything else in this directory. Do commit the contents of this directory to source control. |
bin |
The primary output directory for libraries and NuGet packages when using the build system
(i.e. Do not put anything else in this directory. Do not commit the contents of this directory to source control. |
docs/content |
Use this directory for all your literate documentation source files.
These should be either F# scripts (ending in |
docs/files |
Contains supporting assets needed for documentation generation. For instance, image files which are to be linked/embedded in the final documentation. |
docs/output |
Contains the final artifacts for both narrative and API documentation. This folder will be automatically created by the documenation generation process. Do not put anything else in this directory. Do not commit this directory to source control. |
docs/tools |
Contains tools used in the generation of both narrative documentation and API documentation.
Edit |
docs/tools/templates |
Contains the (default) Razor template used as part of generating documentation.
You are encouraged to edit this template. You may also create additional templates,
but that will require making edits to |
lib |
Any libraries on which your project depends and which are NOT managed via NuGet should be kept in this directory. This typically includes custom builds of third-party software, private (i.e. to a company) codebases, and native libraries. |
nuget |
Stores the NuGet package specifications for your project, typically a |
packages |
Contains any NuGet packages on which your project depends will be downloaded to this directory. Do not put anything else in this directory. Do not commit the contents of this directory to source control. |
src |
The actual codebase (e.g. one, or more, F# projects) in your solution. The project files are automatically renamed from (FSharp.ProjectTemplate) when initializing the project. NOTE: When you add projects to this directory, you will need to edit NOTE: Do not place testing projects in this path. Testing files belong in the |
temp |
This directory is used by the build process as a "scratch", or working, area. Do not put anything else in this directory. Do not commit the contents of this directory to source control. |
tests |
Contains any testing projects you might develop (i.e. libraries leveraging NUnit, xUnit, MBUnit, et cetera).
The sample project included in this directory is configured to use NUnit. Further, NOTE: When you add aditional projects to this directory, you may need to edit |
Path | Description |
---|---|
.travis.yml | Specifies an automated continuous integration (CI) build-and-test on OSX using Travis. Enable your CI build at travis-ci.org by logging on there with your GitHub account and activating the project. If you enable this, then every pull request, commit, branch and tag of your project on GitHub will be built automatically. Builds of open source projects are free. The default build is on Mac OSX (you can also specify Linux by changing the default language). |
appveyor.yml | A specification of an automated continuous integration (CI) build-and-test on Windows using AppVeyor. Enable your CI build at appveyor.com. |
build.cmd and build.sh |
A simple command script which allows the build to be started (i.e. calls build.fsx) from the command prompt or the file system explorer. It also fetches the latest version of F# Make, if it's not detected in packages. |
build.fsx |
This very important file runs the build process. It uses the F# Make library to manage many aspects of maintaining a solution. It contains a number of common tasks (i.e. build targets) such as directory cleaning, unit test execution, and NuGet package assembly. You are encouraged to adapt existing build targets and/or add new ones as necessary. However, if you are leveraging the default conventions, as setup in this scaffold project, you can start by simply supplying some values at the top of this file. They are as follows:
|
FSharp.ProjectScaffold.sln |
This is a standard Visual Studio solution file. Use it to collect you projects, including tests. Additionally, this example solution includes many of the important non-project files. It is compatible with Visual Studio 2012 and Visual Studio 2013. |
LICENSE.txt | This file contains all the relevant legal-ese for your project. |
RELEASE_NOTES.md |
This file details verion-by-version changes in your code. It is used for documentation and to populate nuget package details. It uses a proper subset of Markdown, with a few simple conventions. More details of this format may be found in the documenation for F# Make's ReleaseNotesHelper. |
README.md | Use this file to provide an overview of your repository. |
docs/content/index.fsx | Use this file to provide a narrative overview of your project.
You can write actual, executable F# code in this file. Additionally,
you may use Markdown comments. As part of the build process, this file
(along with any other For further details about documentation generation, please see the FSharp.Formatting library. |
docs/content/tutorial.fsx | This file follows the format of docs/content/index.fsx. It's mainly included to demonstrate that narrative documenation is not limited to a single file, and documentation files maybe hyperlinked to one another. |
docs/tools/generate.fsx |
This file controls the generation of narrative and API documentation. In most projects, you'll simply need to edit some values located at the top of the file. They are as follows:
|
docs/tools/templates/template.cshtml |
This file provides the basic HTML layout for generated documentation. It uses the C# variant of the Razor templating engine, and leverages jQuery and Bootstrap. Change this file to alter the non-content portions of your documentation. Note: Much of the data passed to this template (i.e. items preceeded with '@') is configured in generate.fsx |