How to use UseStaticFiles in ASP.NET Core 1.0

ProfK picture ProfK · May 14, 2016 · Viewed 8.2k times · Source

I can't find many proper Core 1.0 tutorials yet, but when I google the method name, I get umpteen examples that say to include in Startup.cs:

app.UseDefaultFiles();
app.UseStaticFiles();

Yet I get compile errors that neither method exists on app, which is type IApplicationBuilder. Are these calls no longer required, or named totally different, or set somewhere else?

Answer

Mostafiz picture Mostafiz · May 14, 2016

You need to add

"Microsoft.AspNetCore.StaticFiles": "1.0.0",

in your project.json here "1.0.0" is the version you want to use