System.Web.UI in .Net

zequion 91 Reputation points
2024-04-20T05:54:53.8766667+00:00

I am trying to migrate several projects from .Net Framework 4.8 to .Net 8 in WinForms, Wpf and Asp.net that use common c# libraries.

When trying to compile the common dll, errors appear related to "System.Web.UI" which apparently is not used in .Net 8.

I need to be able to compile even in compatibility mode, since now it is not possible for me to replace all the Asp.Net code with Razor.

How can I overcome this error?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,183 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,686 Reputation points
    2024-04-20T15:40:03.8533333+00:00

    You can’t.

    .net 8 does not support 4.8 libraries and there is no compatible mode. System.Web.UI is not supported. Also there are no webform equivalents in .net 8. Many of the MVC classes exist in .net 8 but with some changes.

    you will need to convert each project to .net common 2.0/2.1 or net 8. This requires updating all nuget packages to ones supported by selected project version.

    0 comments No comments

  2. Ping Ni-MSFT 2,250 Reputation points Microsoft Vendor
    2024-04-26T08:49:58.4533333+00:00

    Hi @zequion,ASP.NET Core doesn't have built-in server-side controls like those in Web Forms. Instead, it encourages the use of client-side libraries and frameworks for UI components, such as JavaScript frameworks (React, Angular, Vue.js) or UI libraries (Bootstrap, Materialize CSS).
    Alternatively, you can use Tag Helpers or Razor Components in ASP.NET Core to create reusable UI components.
    Reference:

    Tag Helpers in ASP.NET Core
    ASP.NET Core Razor components


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    Best regards,
    Rena

    0 comments No comments