Monday, April 21, 2014

F# Support for Web Projects

In December of last year, I announced a few templates that made it easy to create pure-F# MVC 5 and Web API 2 projects in Visual Studio 2012 and 2013. In a parallel stream, the F# team was working closely with the F# community to improve the F# web development experience by adding features such as publish-to-web. It's exciting to see that this great work is now available as a Visual F# Tools Preview. You can read more about this at http://blogs.msdn.com/b/fsharpteam/archive/2014/04/06/towards-web-project-support-in-the-visual-f-tools.aspx. This, as well as the recent announcement regarding the acceptance of contributions to the Visual F# Tools, is a huge step forward in the evolution of web development with F#.


Thursday, April 10, 2014

TypeScript in First-Class F# Web Projects

I was recently asked about how best to use TypeScript within a pure F# web project. Currently, there are two steps that are needed to make this happen. 

1. Add the TypeScript item template by downloading and installing the latest version of the F# Web Item Templates extension from http://visualstudiogallery.msdn.microsoft.com/f1dae7fe-1ecc-4f1b-86b5-32a2970d012a.


2. Modify your project file to allow the TypeScript files to compile to JavaScript when the project is compiled. To do this, you need to do the following:

- Edit your fsproj file. 

- Add the TypeScriptToolsVersion element and specify the appropriate TypeScript version that you have installed.


- Add 3 new commands to the BeforeBuild target.


- Save and re-open your project. You should now be good to go.



I plan to work on a solution to reduce the pain of step 2 in the near future, so stay tuned...