1

I have .NET MVC app (.NET Framework 4.6.1) and I want to add ClearScript to my app. I've added package Microsoft.ClearScript via NuGet and after launch app I have error:

Could not load file or assembly 'file:///D:\PathToProject\bin\ClearScriptV8.win-x64.dll' or one of its dependencies. The module was expected to contain an assembly manifest.

This file is in bin folder

What am I doing wrong? And how can I resolve this issue?

UPDATE

The next step I did removing assemblies into web.config files as @BitCortex advised:

<system.web>
  <compilation>
    <assemblies>
      <remove assembly="ClearScriptV8.win-x64" />
      <remove assembly="ClearScriptV8.win-x86" />
    </assemblies>
  </compilation>
</system.web>

but it didn't help.

In the result I've comment out these strings into .csproj file:

<Import Project="..\packages\Microsoft.ClearScript.V8.Native.win-x86.7.2.5\build\Microsoft.ClearScript.V8.Native.win-x86.props" Condition="Exists('..\packages\Microsoft.ClearScript.V8.Native.win-x86.7.2.5\build\Microsoft.ClearScript.V8.Native.win-x86.props')" />
<Import Project="..\packages\Microsoft.ClearScript.V8.Native.win-x64.7.2.5\build\Microsoft.ClearScript.V8.Native.win-x64.props" Condition="Exists('..\packages\Microsoft.ClearScript.V8.Native.win-x64.7.2.5\build\Microsoft.ClearScript.V8.Native.win-x64.props')" />
<Import Project="..\packages\Microsoft.ClearScript.V8.ICUData.7.2.5\build\Microsoft.ClearScript.V8.ICUData.props" Condition="Exists('..\packages\Microsoft.ClearScript.V8.ICUData.7.2.5\build\Microsoft.ClearScript.V8.ICUData.props')" />

Now the initial issue was fixed but during executing script I see the following error:

Cannot load ClearScript V8 library. Load failure information for ClearScriptV8.win-x64.dll:
C:\Users\User\AppData\Local\Temp\Temporary ASP.NET Files\vs\...\runtimes\win-x64\native\ClearScriptV8.win-x64.dll: The specified module could not be found
C:\Users\User\AppData\Local\Temp\Temporary ASP.NET Files\vs\...\ClearScriptV8.win-x64.dll: The specified module could not be found
D:\pathtoproject\ClearScriptV8.win-x64.dll: The specified module could not be found
D:\pathtoproject\bin\ClearScriptV8.win-x64.dll: The specified module could not be found
C:\WINDOWS\system32\ClearScriptV8.win-x64.dll: The specified module could not be found'

What am I doing wrong? And how can I resolve this issue?

What's assembly manifest from initial issue? Maybe some .xml file was missed into package folder or something else? (because I see in bin folder for example ClearScript.V8.dll and ClearScript.V8.xml files)

A. Gladkiy
  • 3,134
  • 5
  • 38
  • 82
  • Does this happen at app startup, or when your app tries to use ClearScript? Also, does this happen in IIS Express, or only in IIS on your deployment server? – BitCortex May 06 '22 at 15:17
  • @BitCortex It happens at app startup and locally into IIS Express. – A. Gladkiy May 06 '22 at 15:20
  • The assembly manifest issue is a red herring. I believe IIS gets confused because it expects all the DLLs in the bin directory to be managed rather than native. When those DLLs are enabled for compilation, that's exactly the error message you get. Removing them from compilation should have fixed the problem. Are you sure you added those lines to all your Web.config files? – BitCortex May 11 '22 at 13:39
  • @BitCortex Yeah, I added these lines of code to all Web.config, app.config (for class library projects) files even into Web.config inside "Views" folder. – A. Gladkiy May 11 '22 at 15:43
  • @BitCortex when we remove those libs from compilation they should be in bin folder in any case or it means they shouldn't be in bin folder? – A. Gladkiy May 11 '22 at 15:52
  • @BitCortex and one more question: I have also Web.Debug.config and Web.Release.config, should I also add those lines of code here? – A. Gladkiy May 11 '22 at 15:56
  • If those files are in bin, they need to be excluded from compilation. If the Web.config changes aren't working for you, try deploying those files in the root application directory (D:\pathtoproject\) instead of bin. – BitCortex May 11 '22 at 18:59
  • @BitCortex Do you mean manually copy/paste those files to (D:\pathtoproject) or something else? – A. Gladkiy May 12 '22 at 11:22
  • @BitCortex I copied/pasted those dlls to (D:\pathtoproject) and commented out – A. Gladkiy May 12 '22 at 14:19
  • Glad to hear you found a solution. You should be able to add those files (ClearScriptV8.win-*.dll, ClearScriptV8.ICU.dat) to the root of your project, setting "Build Action" to "Content" and "Copy to Output Directory" to "Do not copy", for automatic deployment. I still don't understand why the Web.config changes didn't work for you. Something else in your project must be overriding those settings. – BitCortex May 13 '22 at 13:20

2 Answers2

2

You should've also install Microsoft.ClearScript.V8.Native.win-x64 package in addition to the main Microsoft.ClearScript.V8.

This solved the same error message in my case.

jackhab
  • 17,128
  • 37
  • 99
  • 136
0

Try excluding ClearScript's native assemblies from compilation by merging the following into all of your Web.config files:

<system.web>
  <compilation>
    <assemblies>
      <remove assembly="ClearScriptV8.win-x64" />
      <remove assembly="ClearScriptV8.win-x86" />
    </assemblies>
  </compilation>
</system.web>
BitCortex
  • 3,328
  • 1
  • 15
  • 19
  • I've updated question, can you take a look again? – A. Gladkiy May 11 '22 at 09:50
  • The lines you commented out of the project are responsible for deploying ClearScript's native V8 files to the bin directory. That explains the new error message. BTW, the 4th line of that error message indicates that ClearScript looks for those files in the root directory (D:\pathtoproject) in addition to the bin directory. Try deploying the files there. – BitCortex May 11 '22 at 13:34