无法使用 ClearScript.V8 加载程序集或依赖项

Cannot load assembly or dependencies with ClearScript.V8

我正在使用 ClearScript.V8 启动一个项目。 我正在用 C# 开发 Windows 10 & Visual Studio 2015。网络是 IISExpress,最终将在 Windows 2012 服务器上发布。 我使用 NuGet 添加了包 ClearScript.V8 (v5.4.9)。我总是从一开始就得到下面的错误,甚至还没有初始化 ClearScript(是的,它是法语的,但应该很容易理解):

Impossible de charger le fichier ou l'assembly 'ClearScriptV8-32.DLL' ou une de ses dépendances. Le module spécifié est introuvable.

Description : Une exception non gérée s'est produite au moment de l'exécution de la requête Web actuelle. Contrôlez la trace de la pile pour plus d'informations sur l'erreur et son origine dans le code.

Détails de l'exception: System.IO.FileNotFoundException: Impossible de charger le fichier ou l'assembly 'ClearScriptV8-32.DLL' ou une de ses dépendances. Le module spécifié est introuvable.

Erreur source:

Une exception non gérée s'est produite lors de l'exécution de la requête Web actuelle. Les informations relatives à l'origine et l'emplacement de l'exception peuvent être identifiées en utilisant la trace de la pile d'exception ci-dessous.

Trace de la pile:

[FileNotFoundException: Impossible de charger le fichier ou l'assembly 'ClearScriptV8-32.DLL' ou une de ses dépendances. Le module spécifié est introuvable.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +21 System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

[ConfigurationErrorsException: Impossible de charger le fichier ou l'assembly 'ClearScriptV8-32.DLL' ou une de ses dépendances. Le module spécifié est introuvable.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +738
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +217 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +92 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +290
System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +549

[HttpException (0x80004005): Impossible de charger le fichier ou l'assembly 'ClearScriptV8-32.DLL' ou une de ses dépendances. Le module spécifié est introuvable.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10044576 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

Informations sur la version : Version Microsoft .NET Framework :4.0.30319; Version ASP.NET :4.7.2046.0

我遵循了 https://microsoft.github.io/ClearScript/Details/Build.html 的说明(尤其是第 IV 节),所以我有文件 ClearScript.dll、ClearScriptV8-32.dll、ClearScriptV8-64.dll、v8-ia32.dll 和 v8-x64.dll 在我的 bin 文件夹中。我的根文件夹中也有 ClearScriptV8-32.dll 和 ClearScriptV8-64.dll(复制到输出 = 不要复制)。

我错过了什么?

尝试将 所有 这些 DLL(ClearScriptV8-*.dll、v8-*.dll)放入根文件夹,并确保 bin 中有副本。如果您要部署到没有 Visual Studio(或 Visual Studio 但没有 C++ 支持)的机器上,请安装适当版本的 Visual C++ Redistributable(它必须与用于构建 ClearScript 的编译器相匹配)。