muso31/Helixbase

Adding a new view creates AspNetCore errors

Closed this issue · 2 comments

I downloaded the latest code to compare this to my version, which I've marked up similarly. When I right-click in the Hero feature on the Views/Hero folder and add a new Razor view, I get like 15 errors in Visual Studio, most of which are "The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)" and one "'_Views_Hero_Page2.ExecuteAsync()': no suitable method found to override". Sometimes "Feature 'nullable reference types' is not available in C# 7.3. Please use language version 8.0 or greater." shows as well. Also oddly, if I create a controller and then use intellisense to generate the view, it's putting the view in the test project, not the main project.

The code still builds, maybe because the suppression state in the error list is shown as Active for those, but I can just see a solution littered with similar errors. I'm guessing this is all due to the project type of Microsoft.NET.Sdk.web really being a .NET Core type, I'm not sure. Is this a matter of you can't use the built-in view/controller entries to help, because it puts these little things in the background? I know in Anders Laub's version, he's using Microsoft.NET.Sdk for the project type, which doesn't give you the popups for controllers/views so you have to wire everything manually. I'm using the latest VS 2019 to do all this.

Any thoughts on keeping the errors out of the error list? Otherwise any junior devs I hand a starting solution to will freak out!

@kmac23va please pull latest and try again

You're a gentleman and a scholar. The AspNetCore reference shouldn't screw with Sitecore any, but it sure helps here. Thanks!