Multiple components

I have wasm hosted and in Client I get an error when 

builder.Services.AddSyncfusionBlazor();

/Users/gisligudmundsson/Development/Horizon/Client/Program.cs(59,30): error CS1061: 'IServiceCollection' does not contain a definition for 'AddSyncfusionBlazor' and no accessible extension method 'AddSyncfusionBlazor' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?) [/Users/gisligudmundsson/Development/Horizon/Client/Horizon.Client.csproj]

But if I remove it and add e.g. in _Imports.razor

@using Syncfusion.Blazor
@using Syncfusion.Blazor.Buttons


If I add the following line in my Index.razor I get the following erri

<SfButton>Button</SfButton>

/Users/gisligudmundsson/Development/Horizon/Client/Pages/Index.razor(3,1): error RZ9985: Multiple components use the tag 'Syncfusion.Blazor.Buttons.SfButton'. Components: Syncfusion.Blazor.Buttons.SfButton, Syncfusion.Blazor.Buttons.SfButton [/Users/gisligudmundsson/Development/Horizon/Client/Horizon.Client.csproj]

Can anyone help me with this, I have been scratching my head and I just don´t know how to fix this.


1 Reply

AS Aravinthan Seetharaman Syncfusion Team October 11, 2021 03:16 PM UTC

Hi Gisli, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked your query. 
 
Query: Regarding IServiceCollection' does not contain a definition for 'AddSyncfusionBlazor' 
 
Ans: We have checked this query. We suspect that this issue has been occurred due to not properly installing package and using in program.cs file. Please refer the below code snippet. 
 

using Syncfusion.Blazor; 
 
namespace Client5._0 
{ 
    public class Program 
    { 
        public static async Task Main(string[] args) 
        { 
            var builder = WebAssemblyHostBuilder.CreateDefault(args); 
            builder.RootComponents.Add<App>("#app"); 
            builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); 
            builder.Services.AddSyncfusionBlazor(); 
            await builder.Build().RunAsync(); 
 
        } 
    } 
} 

 
.csproj 

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> 
 
  <ItemGroup> 
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.4" PrivateAssets="all" /> 
    <PackageReference Include="Syncfusion.Blazor" Version="19.3.0.44" /> 
    <PackageReference Include="System.Net.Http.Json" Version="5.0.0" /> 
  </ItemGroup> 
</Project> 

 
For more details please refer the below UG link: 
 
 
If you are using individual Nuget please follow the below UG link. 
 
 
Query: Regarding Multiple components use the tag 'Syncfusion.Blazor.Buttons.SfButton' 
 
Ans: We have checked this query. We can resolve this issue by using the namespace in the tag to specify which one you want to use. We suggest you to use the full namespace for each component when use same property (SfButton). 
 

<Syncfusion.Blazor.Buttons.SfButton>Button</Syncfusion.Blazor.Buttons.SfButton>   

 
 
Could you please check the above detail and get back to us, if you need assistance on this. 
 
Regards, 
Aravinthan S 


Loader.
Up arrow icon