Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# IServiceCollection不包含定义AddJsEngineSwitcher_C#_Asp.net Core - Fatal编程技术网

C# IServiceCollection不包含定义AddJsEngineSwitcher

C# IServiceCollection不包含定义AddJsEngineSwitcher,c#,asp.net-core,C#,Asp.net Core,尝试在Visual Studio 2015中构建ReactJS.NET using Microsoft.AspNetCore.Http; using JavaScriptEngineSwitcher.Core; using JavaScriptEngineSwitcher.ChakraCore; using React.AspNet; 在ConfigureServices public void ConfigureServices(IServiceCollection services) {

尝试在Visual Studio 2015中构建ReactJS.NET

using Microsoft.AspNetCore.Http;
using JavaScriptEngineSwitcher.Core;
using JavaScriptEngineSwitcher.ChakraCore;
using React.AspNet;
ConfigureServices

public void ConfigureServices(IServiceCollection services)
{
    // Add framework services.
    services.AddApplicationInsightsTelemetry(Configuration);

    services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
    services.AddReact();

    services.AddJsEngineSwitcher(options => options.DefaultEngineName = ChakraCoreJsEngine.EngineName)
        .AddChakraCore();

     services.AddMvc();
}
public void配置服务(IServiceCollection服务)
{
//添加框架服务。
services.AddApplicationInsightsTelemetry(配置);
services.AddSingleton();
services.AddReact();
services.AddJsEngineSwitcher(options=>options.DefaultEngineName=ChakraCoreJsEngine.EngineName)
.AddChakraCore();
services.AddMvc();
}
此部件出现错误:

AddJsEngineSwitcher

IServiceCollection不包含AddJsEngineSwitcher的定义

试图解决一些问题,但没有成功

也检查我的参考资料

JavaScriptEngineSwitcher 3.0.0
已存在

也在Nuget包中搜索并更改了
JavaScriptEngineSwitcher
,但仍然相同

我正在使用.NET Framework 4.6。

显示您需要安装此NuGet软件包,其中包含缺少的
AddJsEngineSwitcher
扩展方法:

安装后,还需要使用添加以下
,以包括名称空间:

using JavaScriptEngineSwitcher.Extensions.MsDependencyInjection;

添加此依赖项后,我在
ChakraCoreJsEngine.engineame
上收到一个错误“名称ChakraCoreJsEngine在当前上下文中不存在”。我通过安装此
Nuget包解决了上述问题