views:

368

answers:

2

I am using Visual Studio 2008 Integrated Shell with the F# CTP (October). Everything works fine, but when I am trying to open System.Windows.Forms, VS gives an error: the namespace 'Windows' is not defined.

However, it works when I try to open the namespace in F# interactive.

What am I doing wrong?

+2  A: 

The System.Windows.Forms namespace lives in the System.Windows.Forms.dll. You'll need to make sure it's loaded. In fsi use the following to load it from the gac.

#r "System.Windows.Forms";;

then you can use as normal

let w = new System.Windows.Forms.Form() ;;
w.Show();;
w.Close();;
Ball
+3  A: 

For F# Visual Studio projects you will need to right click on your project References entry and walk through the Add Reference dialog. F# Interactive includes references to several frequently used assemblies by default whereas F# application projects only get FSharp.Core, mscorlib, System, and System.Core by default.

Ray Vernagus