aspnet / AspNetWebStack

ASP.NET MVC 5.x, Web API 2.x, and Web Pages 3.x (not ASP.NET Core)
Other
858 stars 354 forks source link

Core equivalent to ProgressMessageHandler #308

Closed nikeee closed 2 years ago

nikeee commented 3 years ago

I'm using the ProgressMessageHandler (with its HttpSendProgress event) to track the progress while uploading a file to a remote HTTP endpoint. This is done in a C# desktop application.

That type is in the namespace System.Net.Http.Handlers and shipped in the System.Net.Http.Formatting.Extension nuget package.

I used this method some time ago because it was the accepted answer in some random stackoverflow post. Now I've ported the application to .NET 6 and get the following warning during compilation:

1><path>.csproj:
warning NU1701: Package 'System.Net.Http.Formatting.Extension 5.2.3' was restored using
'.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8'
instead of the project target framework 'net6.0-windows7.0'.
This package may not be fully compatible with your project.

So, it's clearly a legacy dependency that I'm using here. Now, I found this type in this repository. However, referencing ASP.NET ("legacy" or core) seems to be wrong for a desktop application. Since the new ASP.NET core doesn't seem to have this type anyway, I basically have these questions:

I'd also be thankful for any pointer to other repos/issues/anything.

mkArtakMSFT commented 2 years ago

Thanks for contacting us. The System.Net.Http.Formatting.Extensions is a community-owned package - we don't own it. You can use https://www.nuget.org/packages/Microsoft.AspNet.WebApi.Client/ package which contains the same type, supports .NET Standard 2.0 and will work in .NET 6 app.