Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not see some of the StaticFileExtensions

When I try to make some configurations in Startup.cs I am not able to see some of the StaticFileExtensions.

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
  
            app.UseStaticFiles();    
            app.UseFileServer();   

            app.Run(async (context) => { await context.Response.WriteAsync("Hello!"); });
}

I am not able to invoke these methods. I am a former Windows user and now I am using JetBrains Rider on Macbook and therefore I am not able to host my project InProcess and I can understand that but I expected to be able to use all static file extension methods since they are necessary implementations.

like image 741
madagascar Avatar asked Nov 17 '25 03:11

madagascar


1 Answers

As I understand from your comments above, since you are new on Rider you might have created an empty project. If so, be sure that the following reference is included in your project:

Microsoft.AspNetCore.StaticFiles

. If you already have it and still have an issue I suggest you clean the cache because I just checked an empty project and I only saw Microsoft.AspNetCore as installed. It sounds like a missing reference issue to me.

Open terminal from Rider (or command line in VS) and clean Nuget cache by this command:

dotnet nuget locals all --clear

You may need to restart Rider to see the changes.

like image 196
utaco Avatar answered Nov 19 '25 21:11

utaco



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!