Fslex fsyacc Microsoft also provides a project template. However, this project template contains both lex and YACC files. I think it only applies to Lex, but if it is not convenient to use the command line every time, I still studied the use of msbuild.
Use msbuild hellp. fsproj/V: d to view the entire msbuild process, which is very white.
Hello. fsproj file:
<? XML version = "1.0" encoding = "UTF-8"?>
<Project
Toolsversion = "4.0"
Defaulttargets = "mybuild"
Xmlns = "http://schemas.microsoft.com/developer/msbuild/2003">
<Usingtask taskname = "fslex" assemblyfile = "E: \ Program Files (x86) \ FSharpPowerPack-2.0.0.0 \ bin \ fsharp. powerpack. Build. Tasks. dll"/>
<Usingtask taskname = "FSC" assemblyfile = "$ (msbuildextensionspath32) \ .. \ microsoft F # \ v4.0 \ fsharp. Build. dll"/>
<Propertygroup>
<Assemblyname> Hello </assemblyname>
<Outputpath> bin \ </outputpath>
</Propertygroup>
<Itemgroup>
<Compile include = "*. FS"/>
<Reference include = "fsharp. powerpack"/>
<Reference include = "system"/>
<Reference include = "system. Core"/>
The following code does not need to be written. If the compiler is written, the system prompts-noframework to be used to directly simplify writing.
<Reference include = "mscorlib"/>
<Reference include = "fsharp. Core"/>
</Itemgroup>
<Target name = "mybuild">
<Makedir directories = "$ (outputpath)" condition = "! Exists ('$ (outputpath)') "/>
For more information, see the attributes in the Object Browser.
Two useful paths: Find DLL and targets files. targets is useful when you don't know how to write it. It imitates Microsoft's writing method.
C: \ Program Files (x86) \ microsoft F # \ v4.0
E: \ Program Files (x86) \ FSharpPowerPack-2.0.0.0 \ bin
inputfile =" lexer. FSL "
outputfile =" lexer. FS "
otherflags =" -- Unicode "
/>
sources =" @ (compile) "
outputassembly =" condition (outputpath(((assemblyname).exe "
references =" @ (reference) "
/>
</Target>
<Target name = "clean">
<Delete files = "Export (outputpathcmd.exe"/>
</Target>
<Target name = "rebuild" dependsontargets = "clean; build"/>
</Project>