Visual Studio 2022 assembly and asp.net runtime error

Randunu Dimeshan 21 Reputation points
2022-05-29T07:22:21.2+00:00

206370-screenshot-2022-05-29-125014.png

I am trying to code a C# app on asp.net web core.

I have installed the .net framework 6.0. my computer is a windows 11.

However, I get these two errors whenever I try to add a button or something related. any solution to this?

Developer technologies | ASP.NET | ASP.NET Core
0 comments No comments
{count} votes

Answer accepted by question author
  1. Bruce (SqlWork.com) 82,146 Reputation points Volunteer Moderator
    2022-05-30T18:20:12.857+00:00

    Your confusion is that visual studio supports lots of environments (languages, runtimes, sdks). Many of the environments have designers or toolboxes.

    The toolbox you are trying to use is for the asp.net .net 4.* webform projects. Webforms support was not ported to the newer .net core framework, and can not be used with .net 6 projects.

    asp.net net 6 uses razor pages, and currently there is no designer or toolbox support. Your error is caused by the toolbox code checking if the required webforms library (system.web.dll) for its code generation is installed in the project. As there is web form library for asp.net core, you get this error.


3 additional answers

Sort by: Most helpful
  1. Ken Tucker 5,861 Reputation points
    2022-05-29T08:54:21.057+00:00

    Are you trying to use a .net framework dll in a .net 6 project (.net core)?


  2. Anonymous
    2022-05-30T05:38:37.783+00:00

    Hi @Randunu Dimeshan ,

    The .aspx web page and the Web Server control (with runnat = "server") is in the ASP.NET 4.x Web Form application, it is not work in the Asp.net core application.

    The difference between Asp.net core and .Net Framework, I suggest you could refer the following articles:

    Choose between ASP.NET 4.x and ASP.NET Core

    .NET vs. .NET Framework for server apps

    Then, to learn Asp.net core, I suggest you could refer the following tutorials:

    Tutorial: Create a Razor Pages web app with ASP.NET Core

    Get started with ASP.NET Core MVC

    Besides, if you want to create the .Net Framework application (Asp.net 4.X), you can install the relate component from the Visual Studio Installer, select the ".NET Framework project and item templates" options:

    206591-image.png

    Then, when create the new project via the VS 2022, you can choose the .Net framework template:

    206586-image.png


    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,
    Dillion

    0 comments No comments

  3. Randunu Dimeshan 21 Reputation points
    2022-05-30T13:53:25.227+00:00

    Thank you for the follow-up. I have installed all the components you listed above. And when I try to create an asp.net framework template, it still gives the runtime error notice as in the first picture along with the assembly error msg which shows in my first picture regardless. Should I reinstall the framework and see if it gets fixed?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.