开发者

Web Project for F#

I am building a project system for Visual Studio MVC web projects with controllers written in F#. It comes along pretty cool. I can build and run the apps, but I have a problem with FSharp Language Service.

In the editor it shows the syntax colorization and diagnostic as it should. With one problem - it does not pick up project references. Even though during build it picks them up and successfully开发者_Python百科 builds the project, on the screen it shows the objects/namespaces from the referenced assemblies/projects as unresolved.

If somebody out here has some knowledge about integrating with F# Language service - please help me make it work

In response to Tomas:

The code for F# controllers is in the project file and as I already mentioned I can compile and run it. Originally we kept the F# code in a separate project and desire to get rid of this extra complexity is what prompted this project. It is not a ASP.MVC though it is Bistro MVC.

Edit

BistroMVC now solves this problem in the latest version of the Bistro Designer which is based on the F# project extender


Do you keep your F# source code as part of the Web Project? I'm not sure if this is even possible for ASP.NET MVC, but it was possible in ASP.NET WebForms. With WebForms projects, it didn't work very well (because F# wasn't aware of the project context). I believe it was possible to overcome this with a hacky #if like this:

#if EDITING
#r "Your.Referenced.Library.dll"
#endif

This would serve only as a hint to the editor... However it is much better idea (if it is possible) to write F# controllers in a separate F# project. In that case you shouldn't have any issues (at least I hope so!)


Can you describe what you're doing in more detail? Is this a "flavoring", or a new project system? Are other aspects of the 'project environment' picked up? For example, if you have F# code with

#if DEBUG
let x = 3
#else
let x = 4
#endif

does the coloring change when you change the VS solution from Debug to Release?

(Offhand I am unsure if it will be possible to fully integrate the F# language service into a user-defined project system; if you want more of a discussion, you can email fsbugs@microsoft.com and I'll respond there.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜