asp.net-core – ASP.NET核心添加视图参数名称路径不能为空错误
发布时间:2020-12-16 06:50:55 所属栏目:asp.Net 来源:网络整理
导读:我正在尝试添加视图到我的ASP.NET核心MVC项目,我收到一个错误. 错误消息是 There was an error running the selected code generator: 'Value cannot be null. Parameter name:path' 该视图将用于ViewComponent. 我的步骤是 Right click - Add View - Type V
我正在尝试添加视图到我的ASP.NET核心MVC项目,我收到一个错误.
错误消息是 There was an error running the selected code generator: 'Value cannot be null. Parameter name:path' 该视图将用于ViewComponent. 我的步骤是 Right click -> Add View -> Type View Name -> Uncheck 'Use a Layout Page' -> Template : Empty -> Click Add. 我搜索了一下,但找不到任何结果. 编辑: 这是一个Startup.cs namespace Udemy.MvcWebUI { public class Startup { // This method gets called by the runtime. Use this method to add //services to the container. // For more information on how to configure your application,visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddScoped<IUsersService,UsersManager>(); services.AddScoped<IUsersDAL,EFUsersDAL>(); services.AddScoped<IUsersInfoService,UsersInfoManager>(); services.AddScoped<IUsersInfoDAL,EFUsersInfoDAL>(); services.AddScoped<IEventTypesService,EventTypesManager>(); services.AddScoped<IEventTypesDAL,EFEventTypesDAL>(); services.AddScoped<IEventsService,EventsManager>(); services.AddScoped<IEventsDAL,EFEventsDAL>(); services.AddScoped<ICityService,CityManager>(); services.AddScoped<ICityDAL,EFCityDAL>(); services.AddScoped<IDistrictService,DistrcitManager>(); services.AddScoped<IDistrictDAL,EFDistrictDAL>(); services.AddDbContext<EventContext>(options => options.UseSqlServer(@"Server=localhostSQLEXPRESS;Database=Events; User Id=sa;Password=Omurcan.1994;")); services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app,IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseFileServer(); app.UseNodeModules(env.ContentRootPath); app.UseMvcWithDefaultRoute(); // db tanimi icin using (var serviceScope = app.ApplicationServices.GetService<IServiceScopeFactory>().CreateScope()) { var context = serviceScope.ServiceProvider.GetRequiredService<EventContext>(); context.Database.EnsureCreated(); } } } } 我该如何解决? 谢谢你的帮助. 解决方法
可能是您的项目中缺少Microsoft.VisualStudio.Web.CodeGeneration.Design包!
根据您的项目.NET Core版本安装正确版本的Microsoft.VisualStudio.Web.CodeGeneration.Design nuget包. 然后,如果您最近从任何较低版本将项目更新到.NET Core 2.1,那么也将项目的包更新到最新版本. 然后不要忘记Download .NET Core SDK的最新稳定版本(2.1.500)并在您的机器上安装. 希望你的问题能够得到解决! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- ASP.NET MVC模型绑定 – JSON属性和C#模型属性的不同名称
- asp.net-mvc – ASP.Net MVC在使用Ajax.ActionLink加载时在
- asp.net-mvc – Umbraco 4.11.3 – 控制器类型的当前请求不
- 在ASP.NET菜单控件中设置item.selected
- asp.net-mvc-3 – 使用asp.net MVC在Orchard CMS中检索图像
- 在ASP.NET中使用querystring的最佳做法?
- ASP.NET MVC 5表单验证和错误处理
- asp.net – 有人有一种方法来保持页面呈现一旦一个人已退出
- asp.net-mvc – ASP.NET MVC 1.0中的表单输入验证选项
- asp.net – ERR_CONNECTION_RESET:上传大文件时重置了连接
推荐文章
站长推荐
热点阅读