编译 index.cshtml 抛出运行时错误

希瓦姆·乔拉

我正在尝试更新一个私有的 nuget 包,对此的一些更改导致我出现了一个错误屏幕。

在此处输入图片说明

错误本质上是 An error occurred during the compilation of a resource required to process this request. Please review the following specific error details and modify your source code appropriately. Generated Code One or more compilation references may be missing. If you're seeing this in a published application, set 'CopyRefAssembliesToPublishDirectory' to true in your project file to ensure files in the refs directory are published.The type or namespace name 'Hosting' does not exist in the namespace 'Microsoft.AspNetCore.Razor' (are you missing an assembly reference?)+[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.Views_Home_Index), @"mvc.1.0.view", @"/Views/Home/Index.cshtml")] The type or namespace name 'Hosting' does not exist in the namespace 'Microsoft.AspNetCore.Razor' (are you missing an assembly reference?)

我已经通过网络尝试了各种解决方案来完成我的功课,例如

1)文件中设置CopyRefAssembliesToPublishDirectory'to true.csproj

2) Remove ASP.Net Temporary files

仍然没有运气。

到目前为止,我知道我尝试打开一个网页,当 asp.net 尝试动态编译时,它无法构建解决方案。

我的理解是否完整,我还能做些什么来调试和找到解决方案?

这里有一些.csproj线路<TargetFramework>net461</TargetFramework> <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.3" /> <PackageReference Include="System.Net.Http" Version="4.3.3" />

作为私人性质,我不能分享大部分代码,只能分享常见的东西。

任何帮助深表感谢。

希瓦姆·乔拉

将其设置为<Project Sdk="Microsoft.NET.Sdk.Web" ToolsVersion="15.0">并包含以下文件

<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="2.2.0" /> 帮助解决问题

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

为什么此代码编译并在执行时给出运行时错误

为什么以下条件运算符“?:”会编译却给出运行时错误

CSHTML文件中Lambda表达式的运行时编译器问题

为什么会出现这种使用泛型不会抛出运行时或编译时的异常?

编译错误失败,而不是在运行时抛出“未解决的编译问题”

运行时错误与编译时错误

CSHTML文件不再编译

为什么dart不会抛出编译时错误类型异常。运行时间?

Visual Studio/C++:反向迭代器编译,但在运行时抛出错误

编译并运行时发生错误[NoClassDefFoundError]

为什么keras模型可以编译,但是fit_generator命令会抛出“模型未编译的运行时错误”?

opencv linemod抛出运行时错误

asyncio 抛出运行时错误并忽略异常

Model.fit_generator抛出运行时错误:

元组 foreach、index、find:在运行时返回编译时常量

为什么要提供部分功能来在运行时映射抛出而不是产生编译错误?

除以0是编译器错误或运行时错误

运行时与编译时间

编译Java运行时库时出现Protobuf错误

为什么以下golang程序会抛出运行时内存不足错误?

宏生成的数据透视表抛出运行时错误5

Azure应用服务抛出运行时错误:找不到程序集

cout 新创建的对象抛出运行时错误

Java:编译阶段的运行时反射(?!)

编译/运行时的Java枚举评估

Java库运行时与编译时

java classloader和运行时编译

运行时的Java编译器

运行时重新编译组