Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UseSpaStaticFiles() not found after migrating to dotnet Core 3.1

After upgrading my .NetCore 2.2 application to Net Core 3.1. I am now facing issue in the startup.cs file related to a UseSpaStaticFiles() method.

    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        app
            .UseCors("default")
            .UseStaticFiles()
            .UseSpaStaticFiles(); // this line is giving me error.
       .....
    }

The error says :

Error CS1061 'IApplicationBuilder' does not contain a definition for 'UseSpaStaticFiles' and no accessible extension method 'UseSpaStaticFiles' accepting a first argument of type 'IApplicationBuilder' could be found (are you missing a using directive or an assembly reference?)

To resolve the issue I have tried installing Microsoft.AspNetCore.SpaServices package from Nuget and that also didn't help.

like image 412
Benjamin Avatar asked Dec 20 '19 12:12

Benjamin


Video Answer


1 Answers

This method is contained in the

Microsoft.AspNetCore.SpaServices.Extensions

NuGet package.

like image 94
Pablo Recalde Avatar answered Sep 25 '22 12:09

Pablo Recalde