fgilde / MudBlazor.Extensions

MudBlazor.Extensions from https://www.mudex.org is a small extension for MudBlazor from https://mudblazor.com
http://www.mudex.org
MIT License
245 stars 20 forks source link

[Bug]: app.UseMudExtensions(); not found #110

Open ProgramGeek02 opened 1 day ago

ProgramGeek02 commented 1 day ago

Contact Details

l.iovene@assistinformatica.com

What happened?

I was following the installation guide published here until i face the line that say "if your are running on Blazor Server side, you should also use the MudBlazorExtensionMiddleware you can do this in your startup or program.cs by adding the following line on your WebApplication" but when i try to use that command in my program visual studio say that "'WebApplication' does not contain a definition for 'UseMudExtensions' and no accessible extension method 'UseMudExtensions' accepting a first argument of type 'WebApplication' could be found (are you missing a using directive or an assembly reference?)"

Am I really missing something? My import actually is "MudBlazor.Extensions"

Expected Behavior

to find the right command

Screenshots

no screenshot

Reproduction link

No response

What application type are you referring to?

ServerRendered

Custom Application Type

No response

MudBlazor.Extension Version

2.0.8

MudBlazor Version

7.15.0

What .net Version are you using?

.Net8

What browser are you using?

Edge

Sample Solution

No sample solution

Pull Request

No response

Code of Conduct

fgilde commented 19 hours ago

Because or deprecation of package Microsoft.AspNetCore.StaticFiles and in general no longer support for this kind of http abstractions inside of Microsoft.NET.Sdk.Razor projects I was forced to remove this middleware. This was happen with this commit

At this point a didn't find an alternative approach. If I do I will add this again. However this only adds a small middleware to set the correct JsRuntime this is something you can easially achieve on your own inside of your Server project where middlewares are fully supported. This is the code you need. Hope that helps, and I'am sorry for that

public static IApplicationBuilder UseMudExtensions(this IApplicationBuilder builder)
{
    return builder.Use(async (context, next) =>
    {
        var jsRuntime = context.RequestServices.GetRequiredService<IJSRuntime>();
        JsImportHelper.LegacyRuntimeReference = jsRuntime;
        await next();
    });
}
ProgramGeek02 commented 19 hours ago

Thanks you for your support. Have a nice day.

Luca Iovene Ricerca e sviluppo

[cid:98caf5cc-579f-4322-9cb3-139aa29ee6b6]

T. +39 075 800 10 62 www.assistinformatica.comhttp://www.assistinformatica.com Avviso sulla tutela di informazioni riservate. Questo messaggio è stato spedito da Assist Informatica s.r.l. Esso e gli eventuali allegati, potrebbero contenere informazioni di carattere estremamente riservato e confidenziale. Qualora non foste i destinatari designati, vogliate cortesemente informarci immediatamente con lo stesso mezzo ed eliminare il messaggio e i relativi eventuali allegati, senza trattenerne copia.


Da: Florian Gilde @.> Inviato: martedì 3 dicembre 2024 09:57 A: fgilde/MudBlazor.Extensions @.> Cc: Luca Iovene @.>; Author @.> Oggetto: Re: [fgilde/MudBlazor.Extensions] [Bug]: app.UseMudExtensions(); not found (Issue #110)

Because or deprecation of package Microsoft.AspNetCore.StaticFiles and in general no longer support for this kind of http abstractions inside of Microsoft.NET.Sdk.Razor projects I was forced to remove this middleware. This was happen with this commithttps://github.com/fgilde/MudBlazor.Extensions/commit/49087b1c1ab90237cde2f152e0ad621e2d6716df

At this point a didn't find an alternative approach. If I do I will add this again. However this only adds a small middleware to set the correct JsRuntime this is something you can easially achieve on your own inside of your Server project where middlewares are fully supported. This is the code you need. Hope that helps, and I'am sorry for that

public static IApplicationBuilder UseMudExtensions(this IApplicationBuilder builder) { return builder.Use(async (context, next) => { var jsRuntime = context.RequestServices.GetRequiredService(); JsImportHelper.LegacyRuntimeReference = jsRuntime; await next(); }); }

— Reply to this email directly, view it on GitHubhttps://github.com/fgilde/MudBlazor.Extensions/issues/110#issuecomment-2513911956, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BHNFLETLY4BUSZCVF5FOOPL2DVXBHAVCNFSM6AAAAABS3BWXYKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJTHEYTCOJVGY. You are receiving this because you authored the thread.Message ID: @.***>