How to use UseStaticFiles in ASP.NET Core 1.0
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
To add to Asp.Net Core Web API project using .csproj
rather than project.json
, you can install the package using Nuget Package Manager (search for microsoft.aspnetcore.staticfiles
).
in your project.json make sure you have a reference
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final"
in RC2 that will likely need to change to Microsoft.AspNetCore.StaticFiles
then you should be able to use
app.UseStaticFiles();
Now with release 1.0 the correct reference will be:
"Microsoft.AspNetCore.StaticFiles": "1.0.0"