[英]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是
There's some issues with your NuGet packages. NuGet软件包存在一些问题。
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一起使用。
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. 如果与创建构建任务挂钩(如名称所示),则可能会导致问题。
You should not have references to both Microsoft.AspNetCore.All
and Microsoft.AspNetCore.App
. 您不应同时引用
Microsoft.AspNetCore.All
和Microsoft.AspNetCore.App
。 The current recommendation is to use App
. 当前的建议是使用
App
。
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.