Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

FileExtensionContentTypeProvider in .NET 6+

I am upgrading an old ASP.NET Core 2.2 app to .NET 6

I was able to upgrade every package, however there is one that I’m missing:

Microsoft.AspNetCore.StaticFiles

This package seems to be unmaintained, in fact the last available version on NuGet is 2.2.0, which is marked as deprecated.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I checked my app’s code and the only class I am using from this package is the FileExtensionContentTypeProvider class, which I use to translate file extensions to the corrisponding MIME type.

My question is: can this class be found elsewhere in a non-deprecated and up-to-date package? And if not, is there an non-deprecated equivalent that provides the same functionality (file extension to MIME type translation)?

>Solution :

FileExtensionContentTypeProvider is part of the ASP.NET Core, no extra packages are required nowadays. Check out the Migrate from ASP.NET Core 2.2 to 3.0 docs. Approach to handling dependencies changed considerably during this migration and many Microsoft.AspNetCore packages are not published anymore and should not be directly referenced in the .csproj file, setting project SDK to Microsoft.NET.Sdk.Web is enough.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading