Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Share blazor dialogs across projects within the same solution

$
0
0

I have a solution with multiple .net core 8 blazor projects, including a class library used to share common code:

Solution

  • Project 1
  • Project 2
  • SharedLibrary

Now I'd like to share Blazor Dialogs. My Blazor projects use MudBlazor for UI. For some reason, this doesnt work:

  • Dialog is in Project 1 --> Dialog can be reused within Project 1, not Project 2
  • Dialog is in Project 2 --> Dialog can be reused within Project 2, not Project 1
  • Dialog is in SharedLibrary --> Dialog cannot be used by any Blazor project.

My IDE doesnt show any warnings until the code is compiled. The I receive this error:Error CS0246 : The type or namespace name 'CreateNewFolder' could not be found (are you missing a using directive or an assembly reference?)

Both Project 1 and Project 2 reference the project SharedLibrary and I do have a using statement on the top of the Navigation menu, where the dialog is supposed to be called from:

@using SharedLibrary.Shared

This method is calling the dialog:

private void ShowNewFolder(MouseEventArgs _obj){    ShowNewFolderDialog = true;    var options = new DialogOptions { CloseOnEscapeKey = true,  MaxWidth = MaxWidth.Medium };    DialogService.ShowAsync<CreateNewFolder>("Create New Folder", options);}  

I tried finding relevant question but cannot find anybody having the same issue. Most like I'm missing something very basic.Would somebody pleas be so kind to explain what I'm supposed to do so I can share Dialogs across projects?

Thank you :)


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>