是否可以在服务器上运行f#代码(如果没有安装)(共享服务器)? 我的意思是也许我可以上传和引用所有必要的程序集? f#download place包含“其他cli实现”的zip - 也许有人有simillar问题?
编辑更多上下文:实际上我正在使用c#来编译和运行f#程序。 所以我打电话
using (CodeDomProvider provider = new Microsoft.FSharp.Compiler.CodeDom.FSharpCodeProvider()) { cr = provider.CompileAssemblyFromSource(cp, new string[] { data.Program }); }现在在我的机器上一切都很好。 我已经包含了FSharp.Core.dll(版本4)以及FSharp.Compiler.CodeDom(版本2)。 一切都在本地复制。 在服务器上我收到此错误:
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:所以实际上我想在没有安装f#的服务器上编译 f#代码。 这是我必须做的:
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");这种方式编译成功,如果你想运行它,你必须将Fsharp.Core.dll(v.4)放在与编译的F#程序相同的目录中。
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.
最满意答案
当然 - 只需使用您的项目复制FSharp-Dll或使用--standalone编译器选项。 当然,您的服务器上需要.net(4.0 / 3.5 / 2.0,具体取决于您的F#-version)框架。
最简单的方法:使用参考文献的“复制本地”设置 - 将把垃圾箱放在垃圾箱文件夹中的.exe / .dll旁边(或者让你的输出去掉):
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):
更多推荐
发布评论