is it possible to run f# code on server if it's not installed there (shared server)? I mean maybe I can upload and reference all the necessary assemblies? f# download place contains zip for "other cli implementations" - maybe someone had simillar issues?
Edit More context: actually I'm using c# to compile and run f# program. So I call
using (CodeDomProvider provider = new Microsoft.FSharp.Compiler.CodeDom.FSharpCodeProvider())
{
cr = provider.CompileAssemblyFromSource(cp, new string[] { data.Program });
}
Now on my machine everything is fine. I have included FSharp.Core.dll (version 4) as well as FSharp.Compiler.CodeDom (version 2). Everything is copied locally. On server I get this error:
Could not load file or assembly 'FSharp.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at Microsoft.FSharp.Compiler.CodeDom.FSharpCodeProvider.CreateCompiler()
at System.CodeDom.Compiler.CodeDomProvider.CreateCompilerHelper()
at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources)...
Edit2: So actually I wanted to compile f# code on a server with no f# installed. Here is what I had to do:
1. put FSharp.Compiler.CodeDom.dll (version 2 as there is now newer now) and FSharp.Core.dll version 2 in bin directory.
2. create new directory in bin directory and put there this:
-FSharp.Compiler.dll (version 4)
-FSharp.Core (.dll, .xml, .sigdata, .optdata) (version 4)
-Fsc.exe - f# compiler
3. From code set process' FSHARP_BIN environment variable to point to above directory:
System.Environment.SetEnvironmentVariable("FSHARP_BIN", Utils.RootFolder + @"bin\comilersstuff");
This way compilation is successful and if you'd want to run it, you'd had to put Fsharp.Core.dll (v. 4) in the same directory as compiled F# program.
of course - just copy the FSharp-Dlls with your project or use the --standalone compiler option. Of course you will need the .net (4.0/3.5/2.0 depending of your F#-version) Framework on your server.
Easiest way to do the first: use the "Copy Local" settings for the References - the Dll will be put beside your .exe/.dll in the bin folder (or whereever you let your output go):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With