aspnetcore: Default Blazor Client App fails throwing the build error[Blazor][Appbuilding]
I 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 ?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (6 by maintainers)
Commits related to this issue
- Updated samples to work with .net core 3.0.0-preview8 Solves https://github.com/aspnet/AspNetCore/issues/12712 — committed to erikbra/blazor-workshop by erikbra 5 years ago
- Updated samples to work with .net core 3.0.0-preview8 Solves https://github.com/aspnet/AspNetCore/issues/12712 — committed to erikbra/blazor-workshop by erikbra 5 years ago
- Updated samples to work with .net core 3.0.0-preview8 Solves https://github.com/aspnet/AspNetCore/issues/12712 — committed to erikbra/blazor-workshop by erikbra 5 years ago
- Updated samples to work with .net core 3.0.0-preview8 Solves https://github.com/aspnet/AspNetCore/issues/12712 — committed to erikbra/blazor-workshop by erikbra 5 years ago
- Updated samples to work with .net core 3.0.0-preview8 Solves https://github.com/aspnet/AspNetCore/issues/12712 — committed to erikbra/blazor-workshop by erikbra 5 years ago
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`.