简体   繁体   English

ASP.Net Core MVC缺少程序集参考

[英]ASP.Net Core MVC missing assembly reference

I try to do an login page in Visual Studio 2017 using MVC Empty template. 我尝试使用MVC空模板在Visual Studio 2017中做一个登录页面。 The database connection, the migration and front end code with bootstrap has been done successfully and necessary configuration files and NuGet packages also installed/updated, While I run this application I'm facing this error lines as internal server error 数据库连接,带有引导程序的迁移和前端代码已成功完成,并且必要的配置文件和NuGet软件包也已安装/更新,在运行此应用程序时,由于内部服务器错误,我遇到了此错误行

One or more compilation references are missing. 缺少一个或多个编译参考。 Ensure that your project is referencing 'Microsoft.NET.Sdk.Web' and the 'PreserveCompilationContext' property is not set to false. 确保您的项目引用的是“ Microsoft.NET.Sdk.Web”,并且“ PreserveCompilationContext”属性未设置为false。

The type or namespace name 'Hosting' does not exist in the namespace 'Microsoft.AspNetCore.Razor' (are you missing an assembly reference?) 类型或名称空间名称“托管”在名称空间“ Microsoft.AspNetCore.Razor”中不存在(您是否缺少程序集引用?)

and the added NuGetPackages are 并且添加的NuGetPackages是

  1. Bootstrap 引导程序
  2. BuildBundlerMinifier BuildBundlerMinifier
  3. Microsoft.AspNetCore.All Microsoft.AspNetCore.All
  4. Microsoft.VisualStudio.Web.CodeGeneration.Design Microsoft.VisualStudio.Web.CodeGeneration.Design
  5. Microsoft.AspNetCore.App Microsoft.AspNetCore.App

在此处输入图片说明

There's some issues with your NuGet packages. NuGet软件包存在一些问题。

  1. There is no Bootstrap NuGet package for ASP.NET Core. 没有用于ASP.NET Core的Bootstrap NuGet程序包。 That's only for ASP.NET MVC. 这仅适用于ASP.NET MVC。 I doubt there's any framework dependencies here, but it's a bad idea to use it regardless. 我怀疑这里是否存在任何框架依赖关系,但是无论如何都要使用它是一个坏主意。 For libraries, you should either be using the built-in library manager (libman) or npm with grunt/gulp/webpack. 对于库,您应该将内置库管理器(libman)或npm与grunt / gulp / webpack一起使用。

  2. No idea what BuildBundlerMinifier is, but you likely don't need that either. 不知道BuildBundlerMinifier是什么,但您可能也不需要。 If it's a hook into creating build tasks (as it's name indicates), it's possible this could cause issues. 如果与创建构建任务挂钩(如名称所示),则可能会导致问题。

  3. You should not have references to both Microsoft.AspNetCore.All and Microsoft.AspNetCore.App . 您不应同时引用Microsoft.AspNetCore.AllMicrosoft.AspNetCore.App The current recommendation is to use App . 当前的建议是使用App

  4. Depending on your version of ASP.NET Core, Microsoft.VisualStudio.Web.CodeGeneration.Design could cause problems. 根据您的ASP.NET Core版本, Microsoft.VisualStudio.Web.CodeGeneration.Design可能会引起问题。 Specifically, this reference will break your app if you're targeting Core 2.1+. 具体来说,如果您定位的是Core 2.1+,此参考破坏您的应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ASP.net MVC缺少using指令或程序集引用 - ASP.net MVC missing a using directive or an assembly reference 带有 Blazor 的 ASP.NET Core 3.1 MVC - 缺少程序集 - ASP.NET Core 3.1 MVC with Blazor - Missing Assembly ASP.NET 核心 MVC:定位的程序集的清单定义与程序集引用不匹配 - ASP.NET Core MVC: The located assembly's manifest definition does not match the assembly reference ASP.Net/C#-缺少程序集参考 - ASP.Net / C# - missing an assembly reference 如何在ASP.NET Core项目中包含对程序集的引用 - How to include reference to assembly in ASP.NET Core project 加载 ASP.NET Core MVC 5 项目的程序集时出现 FileNotFoundException - FileNotFoundException when loading assembly of ASP.NET Core MVC 5 project 在 asp.net core 2.2 中找不到类型或命名空间名称“Worker”(您是否缺少 using 指令或程序集引用?)? - The type or namespace name 'Worker' could not be found (are you missing a using directive or an assembly reference?) in asp.net core 2.2? ASP.NET Core MVC 中缺少类型/命名空间 - Missing type/namespace in ASP.NET Core MVC C# ASP.NET 核心 MVC 需要 object 参考 - C# ASP.NET Core MVC An object reference is required NameAndIdProvider 在 class - ASP.NET Core MVC 的上下文中找不到引用 - NameAndIdProvider finds no reference in the context of the class - ASP.NET Core MVC
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM