App_Code 子文件夹中的 F# 代码
我有一个项目,App_code 文件夹中有 2 个子文件夹,一个用于 VB,一个用于 F#(C# 文件位于根目录中)。 我可以很好地访问 VB 类(通过命名空间),但不能访问 F# 代码。 有人遇到过这样的问题吗?如果有,你是如何解决的?
附录: 不在 App_Code 文件夹中的 F# 代码可以正常运行。 这就好像编译器和 IDE 看不到 App_Code 文件夹中名为 FS_Code 的子文件夹中的 F# 代码。 我添加了 codeSubDirectories 元素
<codeSubDirectories>
<add directoryName="VB_Code"/>
<add directoryName="FS_Code"/>
</codeSubDirectories>
VB_Code 子文件夹中的 VB 代码编译得很好。
I have a project with 2 subfolders in the App_code folder, one for VB and one for F# (C# files are in the root). I can access the VB classes just fine (via the namespace) but not the F# code. Has anyone had a problem like this and if so how did you fix it?
Addendum:
F# code that is not in the App_Code folder runs just fine. Is is as if the compiler and IDE do not see the F# code that is in a subfolder of the App_Code folder called FS_Code. I have added the codeSubDirectories element
<codeSubDirectories>
<add directoryName="VB_Code"/>
<add directoryName="FS_Code"/>
</codeSubDirectories>
The VB code in the VB_Code subfolder compiles just fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
请注意,默认情况下,如果您不声明命名空间或模块,则顶级 F# 代码最终会出现在与文件名同名的模块中。 的第一部分
请参阅http://lorgonblog.spaces.live.com /blog/cns!701679AD17B6D310!444.entry
了解详情。
Note that by default, if you don't declare a namespace or module, top-level F# code ends up in a module with the same name as the filename. See the first part of
http://lorgonblog.spaces.live.com/blog/cns!701679AD17B6D310!444.entry
for details.
第三步:盈利!!
说真的,仅仅将 F# 源文件放在 App_Code 下不会有任何作用。
为了让 ASP.NET 应用程序可以编译 F# 代码,您做了哪些准备工作?
Step 3: Profit!!
Seriously, just placing a F# source file under App_Code is not gonna do anything.
What preparation tasks have you done so F# code can be compiled by the ASP.NET application?
也许查看
http://cs.hubfs.net /blogs/tomasp/archive/2008/03/08/aspnet_in_fsharp.aspx
Perhaps check out
http://cs.hubfs.net/blogs/tomasp/archive/2008/03/08/aspnet_in_fsharp.aspx
通过 Reflector 打开实际生成的程序集 - 查看实际的命名空间是什么。
Open up the actual generated assemblies via Reflector - see what the actual namespacing is.
我相信添加> web.config 中 F# 语言的配置元素应该会有所帮助(请参阅 Brian 发布的链接) - 但是,我怀疑您会在 C# IntelliSense 中看到任何内容。 但是,我不清楚如何从一种语言的代码引用另一种语言的代码...
您还可以查看此链接:http://shailkpatel.blogspot.com/2007/10/multiple-programming-languages-in.html
I believe that adding the <compiler ... /> configuration element for the F# language to the web.config should help (see the link Brian posted) - however, I doubt you'd see anything in the C# IntelliSense. However, it's not clear to me how you can reference code in one language from the code in the other...
You can also check out this link: http://shailkpatel.blogspot.com/2007/10/multiple-programming-languages-in.html
自从我问这个问题以来已经有一段时间了,但我认为这最终是 F# 编译器不在 $PATH 中的问题(我将它安装在非标准位置)。
It's been a while since I asked this question but I think it ended up being a problem with the F# compiler not being in $PATH (I had it installed in a non standard location).