Default Blazor Client App fails throwing the build error[Blazor][Appbuilding]
See original GitHub issueI am trying to create an ClientSide Blazor app but I am not even able to build the default blazor app present in the VS
C:\Users\anagniho\source\repos\BlazorApp8>dotnet build
Microsoft (R) Build Engine version 16.3.0-preview-19375-05+42c4c1370 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 30.65 ms for C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj.
You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
obj\Debug\netstandard2.0\RazorDeclaration\Pages\_Imports.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttributeAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
obj\Debug\netstandard2.0\RazorDeclaration\Pages\_Imports.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
obj\Debug\netstandard2.0\RazorDeclaration\Pages\FetchData.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttributeAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
obj\Debug\netstandard2.0\RazorDeclaration\Pages\FetchData.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
obj\Debug\netstandard2.0\RazorDeclaration\Pages\Index.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttributeAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
obj\Debug\netstandard2.0\RazorDeclaration\Pages\Index.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
obj\Debug\netstandard2.0\RazorDeclaration\Pages\Counter.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttributeAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
obj\Debug\netstandard2.0\RazorDeclaration\Pages\Counter.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
Build FAILED.
obj\Debug\netstandard2.0\RazorDeclaration\Pages\_Imports.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttributeAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
obj\Debug\netstandard2.0\RazorDeclaration\Pages\_Imports.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
obj\Debug\netstandard2.0\RazorDeclaration\Pages\FetchData.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttributeAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
obj\Debug\netstandard2.0\RazorDeclaration\Pages\FetchData.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
obj\Debug\netstandard2.0\RazorDeclaration\Pages\Index.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttributeAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
obj\Debug\netstandard2.0\RazorDeclaration\Pages\Index.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
obj\Debug\netstandard2.0\RazorDeclaration\Pages\Counter.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttributeAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
obj\Debug\netstandard2.0\RazorDeclaration\Pages\Counter.razor.g.cs(51,38): error CS0234: The type or namespace name 'LayoutAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Components' (are you missing an assembly reference?) [C:\Users\anagniho\source\repos\BlazorApp8\BlazorApp8.csproj]
0 Warning(s)
8 Error(s)
Time Elapsed 00:00:01.21
Selecting the server app question resolves the issue though. is there anything else that needs to be installed for making it work ?
Issue Analytics
- State:
- Created 4 years ago
- Comments:19 (6 by maintainers)
Top Results From Across the Web
Build fail for Asp.Net Core 3 (Blazor client side)
Basically, as far as I understand it, somewhere in Mono the IL Linker fails and throws this cryptic error message.
Read more >Handle errors in ASP.NET Core Blazor apps
This article describes how Blazor manages unhandled exceptions and how to develop apps that detect and handle errors.
Read more >Blazor Best Practices: Handling Errors
Errors are likely to occur, the question is how to handle them. Let's take a look at best practices in handling them in...
Read more >Global HTTP Error Handling in Blazor WebAssembly
In this article, we are going to learn about handling HTTP errors in the Blazor WebAssembly application. We are going to start with...
Read more >Blazor WASM: How to return 404 error?
I made a blazor wasm project (via template) in VS2022 and see that if I make a (client side) call to a missing...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I hit this issue when using the latest VS 2019 preview 2 to build my solution. My solution was pinned via a global.json file to use sdk preview 7, but I didn’t have sdk preview 7 installed, so the build rolled forward to use sdk preview 8. I have blazor preview 7 dependencies in my dependency graph, and it appears building under preview 8 with preview 7 dependencies, produced this error.
Rather than upgrade everything to preview 8 (some dependencies I use aren’t compiled and released for preview 8 yet and are still on preview 7) I did this to resolve:
dotnet build
- success.I assume this exact same thing can occur each time we go from preview x to preview y - lot of breaking changes at the moment - the build system seems to be very fragile - a bit like goldilocks porridge - everything has to be be “just right” 😃
@erikbra the package
Microsoft.AspNetCore.Components.Browser
was renamed to ``Microsoft.AspNetCore.Components.Web`.