Building F# Projects in Expression Blend Without Installing Visual Studio

Recently, one of our projects hit a snag when I added a F# project to our WPF application. While our developers were able to build the project in Visual Studio 2010 and the Expression Blend 4 RC, our designer was unable to build from within the Expression Blend 4 RC because he did not have Visual Studio 2010 installed.

Behind the scenes, Blend builds projects using MSBuild. Unfortunately, fsc.exe and all the other goodies required to build F# projects are not included with Expression Blend at the moment, but there are a couple of simple workarounds.

The easiest one is to download the F# CTP as a .zip and extract the contents of the FSharp-2.0.0.0\bin folder to C:\Program Files (x86)\Microsoft F#\v4.0\. Restart blend, and your project should build.

Another way to fix the problem is to extract the contents of FSharp-2.0.0.0\bin to another location on your system, and edit your .fsproj file to point to that location if the default 2010 path doesn’t exist. You should see two lines like this in your .fsproj file:

<Import Project="$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets" Condition="!Exists('$(MSBuildBinPath)\Microsoft.Build.Tasks.v4.0.dll')" />
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets" Condition="Exists('$(MSBuildBinPath)\Microsoft.Build.Tasks.v4.0.dll')"  />

Changing those lines to something like the following will also allow blend to build the project. Note that the below assumes you extracted the F# CTP to C:\Program Files (x86)\FSharp-2.0.0.0 which is the location that the .msi extracts it to.

<Import Project="$(MSBuildExtensionsPath32)\..\FSharp-2.0.0.0\bin\Microsoft.FSharp.Targets" Condition="!$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets" />
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets" Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets" />

This entry was posted in Expression Blend, F#. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. Posted September 25, 2010 at 11:47 pm | Permalink

    I’m in that ball park too.
    Interested in any latest update of your experiences.

    I’m using vs2010, F# 2, .net 4, wpf, SL, for my art project Symmorphmetry(tm).
    I’d like to use Expresson Blend too; I think/hope it will make some things eaiser.

    Thanks Art

  2. Chris Marinos
    Posted September 26, 2010 at 1:59 am | Permalink

    Art-

    I don’t really have an update on the issue. The workaround that I described in the post worked for our team, so I haven’t revisited the problem much. If you have VS2010 on your machine, you shouldn’t need the workaround, though.

    Is there anything in particular that you’d like to hear more about?

    -Chris

One Trackback

  1. [...] This post was mentioned on Twitter by Chris Marinos, Chris Marinos. Chris Marinos said: Blogged "Building F# Projects in Expression Blend Without Installing Visual Studio http://bit.ly/9hIanI [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>