Reputation: 448
I am trying to update a private nuget package and some changes for that has lead to me an error screen of this.
The error essentially is
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?)
I have done my homework by trying various solutions over the net such as
1) setting the CopyRefAssembliesToPublishDirectory'
to true
in .csproj
file.
2) Remove ASP.Net Temporary files
still no luck.
so far i understand that i tried opening a web page and when asp.net tried to compile on the fly as it does it couldn't build the solution.
Is my understanding complete and what else can i do to debug and reach the solution?
Here are some .csproj
lines
<TargetFramework>net461</TargetFramework>
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.3" />
<PackageReference Include="System.Net.Http" Version="4.3.3" />
Being the private nature i cant share much of the code but only common things.
any help is much appreciated.
Upvotes: 2
Views: 5024
Reputation: 448
Setting it to <Project Sdk="Microsoft.NET.Sdk.Web" ToolsVersion="15.0">
and including the following files
<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" />
Helped resolving the issue
Upvotes: 2