Assembly Reference is not visible to files in child folder of project (Displaying wrong folder name)

David Gallardo 0 Reputation points
2024-08-15T17:43:33.3833333+00:00

Visual Studio 2022

.NetFramework 4.8

Hello,

I'm running into an issue in my project in which my reference assemblies are only visible to code files in the top level folder of the project. In code files that are located within a child folder (App_Code in my specific case) my using statements are not able to reference the added references.

The below screenshot shows that my Using statements are working in the OnbaseApplication.cs file, which is located in the top-level folder of the project.working

The below screenshot shows that the using statements are not working in the App_Code folder... Something weird I noticed when attempting to build/rebuild the solution is that the error list is saying that the build is looking for 1_App_Code, which does not match the actual name of the folder App_Code. My guess is that this is the reason why the project won't allow me to reference the assemblies, but I have no idea where 1_App_Code is in this project, as you can see per the screenshot that this is not what the folder is named.

not working

error

I want to say thank you ahead of time to any responses. Let me know if I can clarify anything!

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,877 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,142 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,962 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 54,401 Reputation points
    2024-08-15T18:25:53.3966667+00:00

    Notice in that last screenshot that it says "Not Available" and "Available"? These are platforms. Normally you would expect to see something like 'NET Framework 4.7.2andNET 8`.

    Something seems wrong with your project file if I were to wager a guess. Did this problem just start or has it been this way a while? If it just started then can you revert your changes and try again? If you have been hand editing your project file then this could easily break things as well.

    In general the App_Code folder is a well known folder for ASP.NET web apps but I notice you're using MVC. MVC doesn't care about an App_Code folder and doesn't treat it specially. You don't need it and should probably move your files into a better structure anyway.

    I would start by just putting your files into better named folders and removing the App_Code folder. If you had modified the project file to do something special with this folder then get rid of that too. If that doesn't work then we need to look closer at your project file.

    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.