ASP.NET web site build error in VS2022 due to missing assembly reference

MadhukannanBollu-1509 0 Reputation points
2024-12-05T19:12:33.2766667+00:00

I am maintaining an ASP.NET Web site. It has many assemblies (and DLLs) in Bin folder. The web site project is legacy one without any project file. One of the DLLs is DLL that uses CLR. Even though the dll is there in bin folder, building web site gives error error CS0246: The type or namespace name '<namespace name>' could not be found (are you missing a using directive or an assembly reference?). This used to work on VS2017. I tried adding reference again (by right click on project or bin and select the DLL), still it won't work. When i added reference (right click on project, property pages, References tab.. click on Add and choose same dll again), it just adds <dll name>.refresh. Then when i build web site (Build menu -> Build Web site), same error is seen. DLL is built with CLR (in Advanced tab of property page), uses some .NET DLLs and exposes many classes. I would like to know what i can do to successfully build the web site.

Am i missing any configuration or some setting?? here are selected components for ASP.NET workload in VS2022.

User's image

I

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,547 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 68,486 Reputation points
    2024-12-06T17:32:54.49+00:00

    asp.net websites did not use project files. dll's were manually added to the bin or more common the gac. (nuget did not exist at the time). websites used the aspnet compiler. and the code behind files are compiled at site load. all runtime binding information (say a gac reference) is in web.config

    you can google for old articles on converting a website to web application (project file).

    note: to run an old websites on a new machine, you may need to install some assemblies in the GAC (say ado.net). look in web.config for references. you will then need to find the old installers.

    https://learn.microsoft.com/en-us/dotnet/framework/app-domains/working-with-assemblies-and-the-gac

    0 comments No comments

Your answer

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