razor icon indicating copy to clipboard operation
razor copied to clipboard

[WebToolsE2E][Aspire] After adding any component, an error occurs "The type or namespace name 'App' could not be found".

Open v-reinawang opened this issue 1 year ago • 7 comments

REGRESSION INFO: Repro on Aspire 8.0.0 preview 3

INSTALL STEPS

  1. Clean machine: Win11 x64 23h2 ENU
  2. Install VS Code[1.86.2]
  3. Install C# Dev Kit[1.3.10]
  4. Install SDK 8.0.202
  5. Install Aspire.ProjectTemplates.8.0.0-preview.4.24122.7
  6. Apply NuGet Feeds

REPRO STEPS

  1. Open VS Code, Create a new .NET Aspire Application

    • 'Ctrl-Shift-P' > .NET: New Project > .NET Aspire Application
    • Create new folder "aspire" under the home folder (C:\Users<user-name>) and select that folder as the solution folder
    • Name the new project
  2. 'Ctrl-Shift-P' to add a new Blazor Web App project under this solution > give a name 'BlazorApp1'

  3. Right-click the xxx.AppHost > Add project reference to BlazorApp1

  4. Open Program.cs under xxx.AppHost, add following code 'builder.AddProject<Projects.BlazorApp1>("BlazorApp1");'

  5. Right-click the xxx.Web project > Open in Integrated Terminal > add aspire component

    • dotnet add package Aspire.Azure.Storage.Queues --version 8.0.0-preview.4.24122.7
  6. Build and open Program.cs under BlazorApp1

ACTUAL An error occurs "The type or namespace name 'App' could not be found" image

EXPECTED There won't be any errors.

v-reinawang avatar Feb 23 '24 06:02 v-reinawang

Doesn't look aspire related.

davidfowl avatar Feb 23 '24 06:02 davidfowl

Transferring to dotnet/aspnetcore, since this is Blazor related.

eerhardt avatar Feb 23 '24 20:02 eerhardt

Is this just an error that shows up in the editor? Or does this prevent you from running the project? Either way, we think this is probably a razor-compiler issue.

halter73 avatar Feb 27 '24 17:02 halter73

This is just an error that shows up in the editor, the project can run successfully.

v-reinawang avatar Feb 28 '24 06:02 v-reinawang

@dotnet/razor-tooling Given that compilation succeeds, I assume this is a tooling error.

chsienki avatar Feb 29 '24 18:02 chsienki

We've had a couple of instances of the class for a component not being recognized until the .razor/.cshtml file is opened.

phil-allen-msft avatar Mar 28 '24 21:03 phil-allen-msft

Was able to reproduce with

C# DevKit: v1.4.29 C#: v2.22.5

Only happens on project add. Reload of vs code gets rid of the issue

ryzngard avatar Mar 28 '24 23:03 ryzngard

This should be resolved with v2.39.28 (pre-release)

ryzngard avatar Jul 17 '24 20:07 ryzngard