Run f # code on the server, even if f # is not installed there

Is it possible to run f # code on a server if it is not installed there (shared server)? I mean, maybe I can download and reference all the necessary assemblies? f # download location contains zip for "other cli implementations" - maybe someone had problems with simillar?

Change More context: I actually use C # to compile and run the f # program. Therefore i call

using (CodeDomProvider provider = new Microsoft.FSharp.Compiler.CodeDom.FSharpCodeProvider()) { cr = provider.CompileAssemblyFromSource(cp, new string[] { data.Program }); } 

Now everything is in order on my machine. I included FSharp.Core.dll (version 4) as well as FSharp.Compiler.CodeDom (version 2). Everything is copied locally. On the 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 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: Therefore, in fact, I wanted to compile f # code on the server without 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"); 

Thus, the compilation was successful, and if you want to start it, you would have to place the file Fsharp.Core.dll (v. 4) in the same directory as the compiled F # program.

+4
source share
1 answer

of course - just copy FSharp-Dll with your project or use the -standalone option of the compiler. Of course, you will need the .net (4.0 / 3.5 / 2.0 depending on your F # version) Framework on your server.

The easiest way to do the first: use the "Copy local" settings for links - the Dll will be placed next to your .exe / .dll in the bin folder (or if you allow your exit): enter image description here

+8
source

All Articles