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.
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.
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?
Perhaps check out
http://cs.hubfs.net/blogs/tomasp/archive/2008/03/08/aspnet_in_fsharp.aspx
Open up the actual generated assemblies via Reflector - see what the actual namespacing is.
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
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).
Related
I have Delphi Seattle in place and I'm using DUnitX as my test framework.
I noticed that it may have support for stacktrace. But I found no example or documentation about it.
I found an inc file (DUnitX.Stacktrace.inc) where I can configure what I want to use as stacktrace provider. But, as I will not recompile it, because it comes along with Delphi.
How the best approach to enable it now ? When I have an error on tests setup etc. Will I get by default the stacktrace as well ?
Copy the inc file into project folder, apply your changes and include it explicitly:
{$I DUnitX.Stacktrace.inc}
Actually you don't have to reference it directly (Delphi will search in project folder first anyway). Look at DUnitXTest.dproj for example (comes with Delphi in DUnitX\Tests folder).
But i believe it is better to keep things obvious.
Iam using Delphi 2005 and i have included a unit to the main unit using compiler directive i.e.{$I sample.pas} whenever I try to build the main pas file I get the below error . F 1026 File not found and it shows the path where the sample.pas file is available. I tried different options like tried adding the path of the pas file in the project options- search path and also in the tools-options -library path and it doesnt work. I googled it and found a solution which says to do the following:
In the IDE from the main menu, navigate to
“Tools|Options|Environment Options|Compiling and Running”
switch “Show Commandline” ON
AND set sure you have “Verbosity” set to “Diagnostic”.
The problem is Iam using Delphi 2005 and unable to find the “Verbosity” option in Delphi 2005. It would be great if some one can help me
In Delphi 2009 it is right under the Show Commandline setting:
However, unfortunately for you the verbosity option isn't present in D2006, so I guess it was introduced in either 2007 or 2009.
Oh, and as far as the include directive goes: if your sample pas isn't in the same folder as the unit in which it is included, you could try adding the path to the $I directive:
{$I ..\..\General\sample.pas}
Put the file in the same folder as your project units, and change its extension to ".inc" ( not mandatory but I think that by convention directives files are named like this).
A possible solution could be to get the code working in a package and then have the package keep that part of things compiled. I have been able to use include files in other paths with packages, but it is quite tempermental. It can start rejecting them even with packages for reasons I don't know. This is indeed a VERY annoying problem.
You might also look into doing your builds via your own batch files where you can take full control of the command-line settings that are being used.
I would like to use the F# interactive console with the projects in the currently open solution in Visual Studio 2010. Is there a quick and easy way to add a reference in the F# interactive console to reference projects in the currently open solution?
I've got lines like this at the top of my .fs file:
#if INTERACTIVE
#r #"C:\path\to\some.dll"
#I #"C:\Users\bford\path\to\a\project\in\this\solution\bin\Debug"
#r "Project.name"
#endif
Alt-Enter now drops me into fsi with all the required stuff loaded
If it's a project you reference often, you can add an 'always' reference to the FSI command line, under Tools->Options->F# Tools->F# interactive options.
Add a -r switch like:
-r "C:\Users\yaddayadda\MyDll.dll"
I don't think there is any direct way to reference a project in the solution. The best way I can think of is to add a FSX file somewhere to your project with the #r directive:
#r #"bin\Debug\YourProject.dll"
Then you can at least reference the compiled DLL file simply by hitting Alt+Enter in Visual Studio. As far as I know, you cannot reference the project - you can only reference an assembly.
Currently, F# Interactive is really disconnected from the project system in Visual Studio. I suppose that closer integration would be quite useful (but probably difficult to provide).
Now in Visual Studio 2013 you can add a reference to the F# interactive window by right clicking on the referenced dll and clicking "Send to F# interactive".
I would think it should be straightforward to reference the current project, obtain the list of references it contains, and then optionally generate a list of #r (and possibly #i) statements for the interactive session being created, referencing the dll of the project itself as well.
For example: "fsi /i:pathOfLib1 /r:lib1 /i:pathOfLib2 /r:lib2 ...."
PS: base on the MSDN article it doesn't appear that library names can include their path prefixes hence the separate into /i and /i : http://msdn.microsoft.com/en-us/library/dd233172%28v=vs.100%29.aspx
It would be good if the Visual Studio F# Interactive Options menu allowed for the stipulation of a startup script that the invocation could pass to FSI via the "--use:" directive. Such a script could then be passed solution metadata that allows for the environments to be more integrated such as loading latest project outputs.
I can't seem to add a reference to a DLL file in F#. It might be a bug with Visual Studio.
I attempted to add a reference to my F# project by clicking on "Add Reference" -> "browse". I found my DLL, and when I attempted to add it, nothing happened. The window didn't even close to confirm my selection. Help please.
Are you adding a reference to a managed DLL?
Anyways, if you can, make a small repro and send it to fsbugs AT microsoft dot com.
Edit: Here's the list of known issues with the F# Sept CTP.
I think there are some known issues when the DLL is produced by Managed C++, however I don't know the details. In any case, sending a bug report to the F# team as Michael suggests is the best thing to do.
Adding a reference to the F# project never works for me, i need to debug the project, then i reference the resultant dll found in the debug folders. This usually does the trick for me.
When I reference the project it always tells me that there is no dll.
I like the new Add View dialog that was released with RC1. If you specify a view data class, it generates a scaffolded view for you. It seems to work fine with classes defined in projects within my solution. Some of my domain classes inherit from a base class that is defined in an external assembly (and referenced in my web project). I get an error when I specify one of these domain classes. Visual Studio is reporting a TypeLoadException on the external base class.
I did a little debugging with ProcMon and found that it was looking for the base class DLL in, among other places, a temporary folder. That folder did contain the DLL containing my derived domain model class. I did not see the base class's DLL. So for fun, I copied it there and voila, I could add the view.
Is this a bug?
Yes this is a bug. Please file it on http://codeplex.com/aspnet
you actually forgot to add the Web.Config file on the View Folder.
See this small article : http://www.graytechnology.com/Blog/post/ASPNET-MVC-strongly-typed-view-error-Could-not-load-type.aspx
It got me scratching my head quite a bit as well in my current project! :)