C
C#13mo ago
leleco

❔ Exception trying to run code from a .NET Framework 4.5.2 on .NET 6 project

Hi, I have a new project using .NET 6, but I need to call a method in a project using .NET Framework 4.5.2. Per company policies I don't have rights to upgrade this project, so I have to use it as it is. When trying to call a method from this old project, I keep getting this runtime exception:
System.TypeLoadException
HResult=0x80131522
Message=Could not load type 'System.Web.HttpRuntime' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
System.TypeLoadException
HResult=0x80131522
Message=Could not load type 'System.Web.HttpRuntime' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Been trying to search for a solution, but no luck so far. Thanks!
5 Replies
atakancracker
atakancracker13mo ago
I would suggest binding redirects but it doesn't supported in .net 6 I believe
reflectronic
reflectronic13mo ago
the problem is that this project is using ASP.NET 4.x i presume you are trying to use it with an ASP.NET Core project they are not compatible out of the box, which is why you are getting this error
reflectronic
reflectronic13mo ago
it implements many (but not all) of the ASP.NET 4.x methods for use with ASP.NET Core to ease migration so, HttpRuntime would "just work" though, it's possible that something else ends up not working
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts