I am attempting to deploy a simple f# console app to a coworkers computer but it keeps failing. After double clicking on the app icon, the console window appears but then the Microsoft error reporting window shows up asking if I would like to send the error report, I decline then some text flashes in the console window. It looks like an error message, but the window closes too fast to tell. The weird thing is, if I create a similar C# app, it works. I am targeting .net 4 client framework in release mode.
Here is the code
f# code (doesn't work):
open System
printfn "print test"
Console.ReadLine() |> ignore
c# code (does work):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TestCApplication
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Testing...");
Console.ReadLine();
}
}
}
The F# analog of your C# snippet would be not your F# code, but the following:
System.Console.WriteLine "print test"
System.Console.ReadLine() |> ignore
While the app off 2-liner above will run, similarly to one off your C# snippet, just on raw .NET, use of printfn
function in your F# code requires certain F#-specific core components being deployed on the target computer, which is likely not the case. The latter explains the observed behavior.
Look at the references of your F# project and you will see one to FSharp.Core which is normally located here:
C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\FSharp\\2.0\\Runtime\\v4.0\\FSharp.Core.dll
On Windows 7 (64 bit) PC
Also look at the F# site to get the runtime download.
http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/release.aspx
EDIT: here is the direct link to the runtime download (thanks ildjarn):
http://www.microsoft.com/en-us/download/details.aspx?id=13450
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.