C# IServiceCollection不包含定义AddJsEngineSwitcher
尝试在Visual Studio 2015中构建ReactJS.NETC# 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) {
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包解决了上述问题
: