繁体   English   中英

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

[英]Compilation fo index.cshtml throws an runtime error

我正在尝试更新一个私有的 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?) 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) 在.csproj文件中将CopyRefAssembliesToPublishDirectory'设置为true

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" />帮助解决问题

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM