โ Getting rid of System.Net.Http.Formatting
Hi, I am trying to migrate an old ASP.NET MVC 4 / Net 4.5 app to ASP.NET 5 / Net 4.8 (with an eye on switching the libraries to .NET Standard 2.0 and the API to .Net Core 7 with Razor Pages later). I got it to build by downgrading from MVC 5.2.9 to 5.2.3 and adding obscure System.Net.Http.Formatting.Extension package from Nuget that didn't come with any README.
Two problems/questions:
1. While the MVC 5 project builds and runs locally (VS 2022 17.5.4, MSBuild version 17.5.1, .NET Framework 4.8.09032), it doesn't build on Github Actions (MSBuild version 17.5.1) https://github.com/OSLC/oslc4net/actions/runs/4723543633/jobs/8379639727
2. How can I get rid of the kludge System.Net.Http.Formatting.Extension and upgrade to the latest MVC 5.2.9? I read I read https://github.com/Microsoft/dotnet/blob/main/releases/net472/KnownIssues/613745%20-%20Single-name%20references%20are%20removed%20by%20the%20SDK%20when%20targeting%204.7.2.md but while it makes the problem clear, it doesn't seem to help.
Thank you in advance!
GitHub
WIP: Create MVC5 version of the StockQuoteSample ยท OSLC/oslc4net@60...
Contribute to OSLC/oslc4net development by creating an account on GitHub.
GitHub
dotnet/613745 - Single-name references are removed by the SDK when ...
This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Found...
4 Replies
A Java dev here who programmed in C#/.Net professionally ca. 10-12 years ago here trying to refresh my .Net skills. MVC 5 application was created from scratch using https://devindeep.com/how-to-create-asp-net-mvc5-web-project-in-visual-studio-2022/ and the code was moved there manually. Also, to be clear, I removed the extension assembly for Http.Formatting and replaced it with Microsoft.AspNet.WebApi.Client
If I try to update all MVC 5 packages to 5.2.9 and remove the Extensions kludge, I get
CS1705 Assembly 'System.Web.Http' with identity 'System.Web.Http, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Net.Http.Formatting, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Net.Http.Formatting' with identity 'System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
In case it helps ๐https://www.npmjs.com/package/nuget-deps-tree says there is no transitive dep on System.Net.Http.Formatting, Version=5.2.3
npm
nuget-deps-tree
NuGet dependency tree generator. Latest version: 0.3.0, last published: 4 months ago. Start using nuget-deps-tree in your project by running
npm i nuget-deps-tree
. There are no other projects in the npm registry using nuget-deps-tree.Upd: I solved the problem, newly created project with an assembly redirect for System.Web.Http and a https://github.com/Microsoft/dotnet/blob/main/releases/net472/KnownIssues/613745%20-%20Single-name%20references%20are%20removed%20by%20the%20SDK%20when%20targeting%204.7.2.md for System.Net.Http did the trick. I must have messed up something in the process of trying other irrelevant advices.
GitHub
dotnet/613745 - Single-name references are removed by the SDK when ...
This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Found...
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.