Use msbuild to compile the fslex Project

Source: Internet
Author: User
Tags lexer

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>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.