Even if you can't use Visual Studio for some reason (?) you should at least consider using MSBuild and a .fsproj file. Trying to locate .NET assemblies can be a chore, so it is best to let MSBuild do the heavy lifting for you.

Anyway, here is a (slightly modified) sample command-line from building a .NET 3.5 app in Visual Studio, in case it helps you locate some reference assemblies on your box:

C:\Program Files (x86)\Microsoft F#\v4.0\fsc.exe -o:obj\x86\Debug\ConsoleApplication26.exe -g --debug:full --noframework --define:DEBUG --define:TRACE --doc:bin\Debug\ConsoleApplication26.XML --optimize- --tailcalls- --platform:x86 -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v2.0\FSharp.Core.dll" -r:"C:\Program Files (x86)\FSharpPowerPack-1.9.9.9\bin\FSharp.PowerPack.dll" -r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" -r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll -r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\System.Runtime.Serialization.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Web.Extensions.dll" -r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll --target:exe --warn:3 --warnaserror:76 --utf8output --fullpaths Program.fs

Note that .NET 3.5 uses CLR2, that is, it's just the 2.0 mscorlib plus some extra assemblies like System.Core.dll and whatnot. .NET 4.0, on the other hand, is a new CLR/mscorlib.

As for F#, the F# runtime (FSharp.Core.dll) is not part of .NET, so you can either install the F# redistributable on the deployment machine (as mentioned before), or else deploy FSharp.Core.dll alongside your app .exe.

By on 1/24/2011 9:53 AM ()

Ok - now it's all starting to make some sense. I didn't realize that MSBuild was separate from VS. I am getting access to a test computer and will try a couple different renditions of the compilation and post the results. Thank you all for pointing me in the right direction.

By on 1/24/2011 7:00 PM ()

I had the same issue and I was able to overocme it using --standalon compiler option.

fsc -I "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0","C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5" -r System.Core.dll -r System.Xml.dll -r System.Xml.Linq.dll --standalone yourappname.fs

By on 1/27/2011 11:22 AM ()

The simplest thing to do would be to make sure that you include the F# redistributable with your application (or have your users install it separately). It seems unlikely that you really want the --noframework option, which just prevents the compiler from referencing the .NET framework assemblies (and which will therefore cause compile-time errors if you rely on them, as you are observing). Instead, if you don't want to use the F# redistributable for some reason, you can probably use the --standalone flag to embed the F# libraries into your application, but I wouldn't recommend this except as a last resort. See this MSDN page to see the full list of compiler options.

By on 1/23/2011 8:20 PM ()

Thanks for your help. I think that I am still unclear however on how .Net is supposed to work. I was under the impression that once I compiled an assembly in any of the .Net languages, it would be able to work on a machine that has the appropriate .Net libraries installed.

All the users have .Net 3.5 installed and I don't have the ability to install F# on those machines, and neither do the users. I thought this was the whole point of having a CLR! Is there really no way to compile an assembly in F# on one computer and have it work on another that just has .Net? Also, I could include F# libraries like FSharp.Core.dll in the local directory - would this work, and what others would I need to copy?

Thanks again!

By on 1/24/2011 8:51 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper