Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IFormFile not supported

To use IFormFile, we have to install Microsoft.AspNetCore.Http package, but it is deprecated in .NET 8. How to solve this problem?

I tried to add IFormFile to upload an image. But to add IFormFile, I need to reference Microsoft.AspNetCore.Http, but it is deprecated in .Net 8.

I also tried to install Microsoft.AspNetCore.Http.App, but it is throwing an error

The package Microsoft.AspNetCore.App.Ref 8.0.4 has a package type DotnetPlatform that is incompatible with this project

like image 481
Anand Avatar asked Dec 06 '25 16:12

Anand


1 Answers

When I'm creating the .NET 8 ASP.NET MVC project the Visual Studio automatically adds reference to the Microsoft.AspNetCore.App shared framework and this is enough to use the IFormFile in my project. I'm not receiving any deprecating messages.

This interface declared in the Microsoft.AspNetCore.Http namespace that is part of the Microsoft.AspNetCore.App shared framework.

For an additional information see Use the ASP.NET Core shared framework

like image 87
Victor Avatar answered Dec 10 '25 00:12

Victor