Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix blazor error " The namespace 'Razor' already contains a definition for 'Template' "

Tags:

c#

blazor

After creating a new blazor component i get this error:

 The namespace 'Razor' already contains a definition for 'Template'

Is it a bug with auto generation or something? How can i fix it in blazor? It appears very often and i have no idea why. Blazor is pretty new framework, can somebody defeated this problem? Thank you in advance!

like image 452
giacomo12312213132 Avatar asked Sep 11 '19 08:09

giacomo12312213132


1 Answers

<PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
    ...
    <RazorLangVersion>3.0</RazorLangVersion>
    <AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>

Adding AddRazorSupportForMvc fixes the issue for me

like image 94
Dbl Avatar answered Oct 09 '22 17:10

Dbl