edge-fs icon indicating copy to clipboard operation
edge-fs copied to clipboard

Could not load file or assembly 'FSharp.Core, Version=4.0.0.0, ...'

Open moodmosaic opened this issue 12 years ago • 4 comments

The following exception is thrown on Windows 8.1 with Visual Studio 2013 installed:

...\node_modules\edge\lib\edge.js:143
    return edge.initializeClrFunc(options);
                ^
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot
find the file specified.
   at EdgeCompiler.CompileFunc(IDictionary`2 parameters)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at ClrFunc.Initialize(Handle<v8::Value>* , Arguments* args)

Is it possible to supply an assembly binding redirection to edge-fs with an app.config file?

moodmosaic avatar Jan 18 '14 21:01 moodmosaic

You should be able to specify assembly redirects in node.exe.config next to node.exe.

tjanczuk avatar May 18 '14 23:05 tjanczuk

I specified the following assembly binding redirect in node.exe.config next to node.exe:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="FSharp.Core"
                          publicKeyToken="b03f5f7f11d50a3a"
                          culture="neutral"/>
        <bindingRedirect oldVersion="4.0.0.0"
                         newVersion="4.3.1.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

It doesn't seem to work though. Now I get I slightly different message:

H:\Projects\edge-fs-sample\node_modules\edge\lib\edge.js:149
    return edge.initializeClrFunc(options);
                ^
System.Reflection.TargetInvocationException: Exception has been thrown by the ta
rget of an invocation. ---> System.IO.FileNotFoundException: Could not load file
 or assembly 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f
5f7f11d50a3a' or one of its dependencies. The system cannot find the file specif
ied.
   at Microsoft.FSharp.Build.Fsc..ctor()
   at EdgeCompiler.tryCompile(String source, IEnumerable`1 references)
   at EdgeCompiler.tryGetAssembly(String lineDirective, String source, IEnumerab
le`1 references, Boolean islambda)
   at EdgeCompiler.CompileFunc(IDictionary`2 parameters)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments,
 Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Objec
t[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
Attr, Binder binder, Object[] parameters, CultureInfo culture)
   at ClrFunc.Initialize(Handle<v8::Value>* , Arguments* args)

Even if I try with FSharp.Core, Version=4.3.0.0 in the assembly redirect I get the same message.

moodmosaic avatar May 19 '14 09:05 moodmosaic

That error sounds like you only have F# 3.1 installed and its looking for FSharp.Core 4.3.0.0 in the GAC which is not included with F#3.1

Im not sure what versions of VS you have installed. I don’t think FSharp.Core 4.3.0.0 is installed with VS2013.

On 19 May 2014, at 10:37, Nikos Baxevanis [email protected] wrote:

I specified the following assembly binding redirect in node.exe.config next to node.exe:

It doesn't seem to work though. Now I get I slightly different message:

H:\Projects\edge-fs-sample\node_modules\edge\lib\edge.js:149 return edge.initializeClrFunc(options); ^ System.Reflection.TargetInvocationException: Exception has been thrown by the ta rget of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f 5f7f11d50a3a' or one of its dependencies. The system cannot find the file specif ied. at Microsoft.FSharp.Build.Fsc..ctor() at EdgeCompiler.tryCompile(String source, IEnumerable1 references) at EdgeCompiler.tryGetAssembly(String lineDirective, String source, IEnumerab le1 references, Boolean islambda) at EdgeCompiler.CompileFunc(IDictionary`2 parameters) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Objec t[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke Attr, Binder binder, Object[] parameters, CultureInfo culture) at ClrFunc.Initialize(Handlev8::Value* , Arguments* args) — Reply to this email directly or view it on GitHub.

7sharp9 avatar May 19 '14 09:05 7sharp9

Hm... After doing that I got Unable to build Dynamic Assembly, no assembly output:

H:\Projects\edge-fs-samples\node_modules\edge\lib\edge.js:149
    return edge.initializeClrFunc(options);
                ^
System.Reflection.TargetInvocationException: Exception has been thrown by the ta
rget of an invocation. ---> System.InvalidOperationException: Unable to build Dy
namic Assembly, no assembly output.
   at EdgeCompiler.CompileFunc(IDictionary`2 parameters)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments,
 Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Objec
t[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
Attr, Binder binder, Object[] parameters, CultureInfo culture)
   at ClrFunc.Initialize(Handle<v8::Value>* , Arguments* args)

moodmosaic avatar May 19 '14 12:05 moodmosaic