0

I have issues with ClearScript. When I use them from regular project (class library or wpf), when dependency is added through nuget, also a post build script is added that copies ClearScriptV8-32.dll, ClearScriptV8-64.dll, v8-ia32.dll and v8-x64.dll to bin directory and everything works well. But when I try to use this library with new ASP.NET, things go wrong.

Nuget ClearScript package for dnx is downloaded to

C:\Users\lukasz\.dnx\packages\ClearScript.V8\5.4.3\lib\net40

I mean, ClearScript.dll is there but those 4 other files are not (they are ..\..\tools\native\{x86,amd64}\*, just like in case of desktop app), and when I run app it says

System.IO.FileNotFoundException: Cannot find file 'C:\Users\lukasz\.dnx\packages\ClearScript.V8\5.4.3\lib\net40\ClearScriptV8-32.dll'

So following my experiences from regular projects, I just copied those 4 files from

.dnx\packages\ClearScript.V8\5.4.3\tools\native\{x86,amd64}\*

to

.dnx\packages\ClearScript.V8\5.4.3\lib\net40

And then I get this error

Error: error CS0009: Metadata file 'C:\Users\lukasz\.dnx\packages\ClearScript.V8\5.4.3\lib\net40\v8-x64.dll' could not be opened -- PE image doesn't contain managed metadata.
error CS0009: Metadata file 'C:\Users\lukasz\.dnx\packages\ClearScript.V8\5.4.3\lib\net40\v8-ia32.dll' could not be opened -- PE image doesn't contain managed metadata.

I would asume that those dlls are somehow not valid for web version, maybe I need to get those dlls in some different way?

I could reproduce the issue creating new ASP.NET 5 project from WebApi template. I use single framework dnx46, no core as the projects I use are not compiled against it anyway. I use ClearScript.V8 5.4.3. DNX SDK version is 1.0.0-rc1-update1.

I am simply creating

var engine = new V8ScriptEngine();

in the controller method.

Łukasz
  • 8,555
  • 2
  • 28
  • 51
  • Can you try moving those files (ClearScriptV8-\*.dll, v8-\*.dll) to your application's root directory? – BitCortex May 24 '16 at 18:55
  • What do you mean root directory? Where the code is? You mean solution or the project? – Łukasz May 24 '16 at 19:18
  • Sorry, I meant the root directory where your application is deployed. On your development machine that's probably the project root. From ClearScript's ReadMe: *For ASP.NET projects, we recommend that you add these assemblies as content files at the root of your web application and set their "Copy to Output Directory" properties to "Do not copy".* – BitCortex May 24 '16 at 19:50
  • I tried solution directory, solution/artifacts/bin/appname/, solution/artifacts/obj/appname/Debug, solution/appname/src/, solution/appname/src/wwwroot/ I also tried ~/.dnx/bin/, ~/.dnx/runtimes/dnx-clr-win-x86.1.0.0-rc1-update1/bin/ (and all other runtimes). Both IDE and Kestrel say that file is not found in same path as in my question. – Łukasz May 25 '16 at 07:08
  • I went into solution explorer to references/dnx 4.6/clearscript.v8 and I noticed it has all 5 dls in there. I tried upgrading to 5.4.5 and that has only 1 dll in the tree, program runs no problem, throws exception when I try to access page, but it expects dll in ~/.dnx/runtimes\dnx...\bin dir, when I copied them there it all works. I will try to update clearscript in my main project and see if it works. – Łukasz May 25 '16 at 07:09
  • Well, it works now, damn... So it was just the version. – Łukasz May 25 '16 at 10:32

0 Answers0