Waleed Aladin
Waleed Aladin

Reputation: 39

MudBlazor project return error Found markup element with unexpected name 'MudNavMenu' when first create

When first time to create new project of type MudBlazor it return this error message : Found markup element with unexpected name 'MudNavMenu'

I create the project through CLI:

dotnet new mudblazor --host wasm --name MyApplicationName

And error never gone after updating or restoring packages or restarting visual studio 2019

Any Ideas?

enter image description here

Update:

I got this error after while :

Severity    Code    Description Project File    Line    Suppression State

Error   NETSDK1045  The current .NET SDK does not support targeting .NET 6.0.  Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 6.0.    MudBlazorApplication    C:\Program Files\dotnet\sdk\5.0.410\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets   141

I have SDK 6 and runtime installed already

enter image description here

Upvotes: 2

Views: 1374

Answers (2)

Skattch
Skattch

Reputation: 9

I just encountered this problem with several of my components. They had been working fine for a long time then suddenly I received this error and the component would not render. This is even though in the editor the component validated.

The cause of the problem is that when updating VS it also upgraded my machine to .net SDK 7.0.302. There is a bug in that version which will cause this problem when a blazor component is inherited.

To resolve the problem, downgrade to SDK 7.0.203.

You do this by creating a global.json file.

If, like me, you do not know how to do this, it is easy:

  1. From the root folder of your solution, enter the following command:
  2. dotnet new globaljson --sdk-version 7.0.203

That's it. That is all you have to do.

Upvotes: 0

Waleed Aladin
Waleed Aladin

Reputation: 39

I had to recreate the project through Visual studio 2022 and changed the MudBlazor project type to server instead of host wasm and It works now I don't know if WebAssemblyHostBuilder is not compatible with SDK 6.0 or what

Upvotes: -1

Related Questions