Compiling F# programs using msbuild

649 views
Skip to first unread message

Kennis Koldewyn

unread,
May 9, 2013, 5:30:35 PM5/9/13
to fsharp-o...@googlegroups.com
How should I be compiling F# programs using msbuild?  (Note that I'm not using Visual Studio for development.)  Msbuild has tasks for compiling C# programs (using the CSC task) and VB.NET programs (using the VBC task), but as far as I know, msbuild doesn't have a task to wrap the F# compiler.  Is the best I can do the Exec task, or is there something better?

Thanks!

Dave Thomas

unread,
May 9, 2013, 5:31:47 PM5/9/13
to fsharp-o...@googlegroups.com
There is an msbuild task that wraps fsc too, its i the Fsharp.Build dll.

Dave.

On 9 May 2013, at 22:30, Kennis Koldewyn <kennis....@gmail.com> wrote:

How should I be compiling F# programs using msbuild?  (Note that I'm not using Visual Studio for development.)  Msbuild has tasks for compiling C# programs (using the CSC task) and VB.NET programs (using the VBC task), but as far as I know, msbuild doesn't have a task to wrap the F# compiler.  Is the best I can do the Exec task, or is there something better?

Thanks!

--
--
You received this message because you are subscribed to the Google
Groups "FSharp Open Source Community" group.
To post to this group, send email to fsharp-o...@googlegroups.com
To unsubscribe from this group, send email to
fsharp-opensou...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/fsharp-opensource?hl=en
 
---
You received this message because you are subscribed to the Google Groups "FSharp Open Source Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fsharp-opensou...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Kennis Koldewyn

unread,
May 13, 2013, 5:31:22 PM5/13/13
to fsharp-o...@googlegroups.com
On Thursday, May 9, 2013 5:31:47 PM UTC-4, 7sharp9 wrote:
There is an msbuild task that wraps fsc too, its i the Fsharp.Build dll.

Ah, indeed, and (on my Windows 7 x64 machine) it's in C:\Program Files (x86)\Microsoft SDKs\F#\3.0\Framework\v4.0, and when I copy the files in that directory to my .NET framework directory (C:\Windows\Microsoft.NET\Framework\v4.0.30319), then msbuild can run the FSC task without problems.  Thanks for your help!

Kennis Koldewyn

unread,
May 14, 2013, 10:56:24 AM5/14/13
to fsharp-o...@googlegroups.com
I'm sorry, a correction in case anyone else runs into the same problem: copying the F# framework files (FSharp.Build.dll, Microsoft.FSharp.targets, etc.) to the .NET framework directory is not enough.  You still have to import the .targets file in your Build.xml:

<Import Project="$(MSBuildToolsPath)/Microsoft.FSharp.targets"/>

Don Syme

unread,
May 14, 2013, 11:00:44 AM5/14/13
to fsharp-o...@googlegroups.com

Hi Kennis,

 

You shouldn’t actually need to copy the files – referencing the targets file in a project file should be sufficient.

 

For example, see any .fsproj file produced by Visual Studio. These are used as XML input to MSBuild, e.g. this one:

 

https://github.com/fsharp/fsharp/blob/master/tests/projects/Sample_VS2012_FSharp_ConsoleApp_net45/Sample_VS2012_FSharp_ConsoleApp_net45/Sample_VS2012_FSharp_ConsoleApp_net45.fsproj               

cheers

don

--

Dave Thomas

unread,
May 14, 2013, 11:38:17 AM5/14/13
to fsharp-o...@googlegroups.com, fsharp-o...@googlegroups.com
I'm my case I was calling that dll programatically, using the build task direct. 

Kennis Koldewyn

unread,
May 14, 2013, 2:58:57 PM5/14/13
to fsharp-o...@googlegroups.com
Fair enough (note that you can use $(MSBuildProgramFiles32)\Microsoft SDKs... instead of $(MSBuildExtensionsPath32)\..\Microsoft SDKs..., which seems a little cleaner to me.)  I'm doing F# development in Linux as well as Windows, so I'm trying to see if I can write a Build.xml file that will be OS agnostic and work the same under msbuild and xbuild.

Pankaj Roshwal

unread,
Nov 8, 2016, 10:22:45 AM11/8/16
to F# Discussions
Hi Dave,
I have multiple project in my solutions some are C# project and one F# project,Whenever i build my solution with Visual studio 2013 it successfully build but when i build it using bamboo its getting fail because of F# project.How i resolve this issue ,Please help.  

Pankaj Roshwal

unread,
Nov 8, 2016, 10:30:26 AM11/8/16
to F# Discussions
Hi Kennis,
I have multiple project in my solutions some are C# project and one F# project,Whenever i build my solution with Visual studio 2013 it successfully build but when i build it using bamboo its getting fail because of F# project.How i resolve this issue ,Please help.  

Reply all
Reply to author
Forward
0 new messages