[英]F#: Namespace not defined when trying to open System.Windows.Forms
I am using Visual Studio 2008 Integrated Shell with the F# CTP (October). 我正在使用Visual Studio 2008 Integrated Shell和F#CTP(十月)。 Everything works fine, but when I am trying to open System.Windows.Forms , VS gives an error:
the namespace 'Windows' is not defined
. 一切正常,但是当我尝试打开System.Windows.Forms时 ,VS会出错:
the namespace 'Windows' is not defined
。
However, it works when I try to open the namespace in F# interactive . 但是,当我尝试在F#interactive中打开命名空间时,它会起作用。
What am I doing wrong? 我究竟做错了什么?
For F# Visual Studio projects you will need to right click on your project References entry and walk through the Add Reference dialog. 对于F#Visual Studio项目,您需要右键单击项目的References条目并浏览Add Reference对话框。 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.
F#Interactive默认包含对几个常用程序集的引用,而F#应用程序项目默认只获取FSharp.Core,mscorlib,System和System.Core。
The System.Windows.Forms namespace lives in the System.Windows.Forms.dll. System.Windows.Forms命名空间位于System.Windows.Forms.dll中。 You'll need to make sure it's loaded.
你需要确保它已加载。 In fsi use the following to load it from the gac.
在fsi中使用以下命令从gac加载它。
#r "System.Windows.Forms";;
then you can use as normal 然后就可以正常使用了
let w = new System.Windows.Forms.Form() ;;
w.Show();;
w.Close();;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.