C
C#9mo ago
UnFuzed

App not found in VSCode

Hey Whenever I make a new Blazor Web App in VSCode it gives me this error and fails to run. What do I need to do to fix this
No description
42 Replies
Buddy
Buddy9mo ago
it gives me this error and fails to run.
A red squiggly line - Tells much.
UnFuzed
UnFuzedOP9mo ago
The type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?) I tell the error in the title "of not being found" App is also not found in Visual Studio as well
Angius
Angius9mo ago
Well, the error is quite clear then, isn't it? There's no class named App
UnFuzed
UnFuzedOP9mo ago
Yes. But its the DEFAULT page that is created with the template so why is it there Why does this not occur with others using Visual Studio but it happens for me on both
Buddy
Buddy9mo ago
Can it compile?
UnFuzed
UnFuzedOP9mo ago
No
Buddy
Buddy9mo ago
I see, usually VSCode bugs out and shows random errors, that is why I asked. Mind posting the file structure?
UnFuzed
UnFuzedOP9mo ago
No description
Buddy
Buddy9mo ago
Where is App class?
UnFuzed
UnFuzedOP9mo ago
No where App is created by DEFAULT in the Blazor Template
Buddy
Buddy9mo ago
Are you sure you are not looking at old docs? I personally have not touched web dev so I have no idea what is created and what isn't, but seems like it (docs) does not call that method.
UnFuzed
UnFuzedOP9mo ago
When I create a Blazor Web App in VSCode using the C# Dev Kit OR using Visual Studio Community 2022. It creates "program.cs" with "App" referenced. Both using Dotnet 8.0 I never touched program.cs and it just has it. Using this code. Does work though
Buddy
Buddy9mo ago
Do you have a file called App.razor?
UnFuzed
UnFuzedOP9mo ago
no it never created one wait It did? Yea 🤔 but its just HTML stuff
UnFuzed
UnFuzedOP9mo ago
No description
Buddy
Buddy9mo ago
Which .NET version do you use?
UnFuzed
UnFuzedOP9mo ago
8.0
Buddy
Buddy9mo ago
Try creating a new webapp, does it work there?
dotnet new webapp -o RazorPagesMovie
code -r RazorPagesMovie
dotnet new webapp -o RazorPagesMovie
code -r RazorPagesMovie
https://learn.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/razor-pages-start?view=aspnetcore-8.0&tabs=visual-studio-code#create-a-razor-pages-web-app
UnFuzed
UnFuzedOP9mo ago
K one sec Yes but it seems like this is Razor? and not Blazor?
Buddy
Buddy9mo ago
https://learn.microsoft.com/en-us/aspnet/core/blazor/components/integration?view=aspnetcore-8.0#razor-component-integration Seems like the API is for Razor pages only (?), you are mapping for razor components.
Angius
Angius9mo ago
For RPages and VMC, IIRC
UnFuzed
UnFuzedOP9mo ago
I am confused as I had this working but now its not working at all.. and not even in Visual Studio. Ugh
Angius
Angius9mo ago
Aight, do you want to create a Blazor WASM, Blazor Server, or just mixed Blazor project with the backend server?
UnFuzed
UnFuzedOP9mo ago
For class we specifically need a "Blazor Web App"
UnFuzed
UnFuzedOP9mo ago
No description
Angius
Angius9mo ago
Right, and creating this project in VS creates incorrect, non-working code? Or is it only creating it via the dotnet CLI that creates incorrect, non-working code? If so, what is the template you use with dotnet new?
UnFuzed
UnFuzedOP9mo ago
aright I retried it in VS and not code. It works in there but when I load it into VScode it still shows an error
Angius
Angius9mo ago
At this point I'm just gonna say "VSCode being VSCode lmao"
UnFuzed
UnFuzedOP9mo ago
I use the command tool in VSCode to "Dotnet: New Project" Yea but I had it working but now it won't
Angius
Angius9mo ago
Aight, Dotnet: New Project... I assume it lets you select the template?
UnFuzed
UnFuzedOP9mo ago
yea
Angius
Angius9mo ago
If so, which template did you pick?
UnFuzed
UnFuzedOP9mo ago
"Blazor Web App"
Angius
Angius9mo ago
huh And this is what creates a non-working project?
UnFuzed
UnFuzedOP9mo ago
it creates the same as VS but it works in VS now 🤷‍♂️ so its something with VSCode 😦 at this point I just have to swap over for this one class
Angius
Angius9mo ago
VSCode never was a great pick for C# It got slightly less shit thanks to the DevKit extension
UnFuzed
UnFuzedOP9mo ago
Yea but I had it working just fine until class was like.. use this and there was no fix for it that i could find
Buddy
Buddy9mo ago
Reason why I hate VSCode nr. 5000
UnFuzed
UnFuzedOP9mo ago
After some fucking around I got it to work. It seems like VSCode is just displaying a random error that doesn't exist I deleted my whole Blazor Web App in my project and created it in VS Then just loaded it up in VScode
UnFuzed
UnFuzedOP9mo ago
No description
UnFuzed
UnFuzedOP9mo ago
RenoWebApp/Components is where the App.Razor is found but it doesn't intelisense it
Want results from more Discord servers?
Add your server