Skip to content

Blazor (client project) does not compile if cshtml file present in folder structure #9640

@tn-5

Description

@tn-5

Describe the bug

It looks like the sdk uses the presence of a file with a ".cshtml" extension to detect that mvc is required. For a normal blazor project it then complains that:
The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNetCore'

To Reproduce

  • dotnet new blazor
  • create file "a.cshtml" with no content in root of project
  • dotnet build fails

Expected behavior

  • Provide a more meaningful error message
  • Allow the cshtml file to be excluded (currently if it is put in an itemgroup with build action=none it still has an effect, it should probably be ignored in those conditions)

Ideally what is required is any way (such as build action none in project file) to allow this file to be in the project structure but be ignored for the purposes of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions