The fsproj
file is actually an MS Build script, so you can use the standard MS Build functions to define variables (such as your inclusion path) and use them in the project file. It is not as simple as using the #I
directive in F # script files, but it should give you similar functions.
For example, you can create an Includes.proj
file that defines your include path as follows:
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <IncludePath>C:\MyIncludePath</IncludePath> </PropertyGroup> </Project>
You can then modify the fsproj
file to link to the above file and use $(IncludePath)
in your links. Unfortunately, this must be done in a text editor (i.e. unload the project, change it and then reload):
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="Includes.proj" /> <ItemGroup> <Reference Include="mscorlib" /> <Reference Include="System" /> <Reference Include="FSharp.Core" /> <Reference Include="MyAssembly"> <HintPath>$(IncludePath)\MyAssembly.dll</HintPath> </Reference> </ItemGroup> </Project>
source share