error in asp.net

Simon 466 Reputation points
2025-05-01T15:15:58.0966667+00:00

i configoring ny project of asp.net and code vb.net

i got this errror

Error in project-level import 'app.config' at 'app' : 'app' is not accessible in this context because it is 'Friend'.

i dont have in my project a file named app.config how can i fix this error

Developer technologies | ASP.NET | ASP.NET API
{count} votes

1 answer

Sort by: Most helpful
  1. Danny Nguyen (WICLOUD CORPORATION) 725 Reputation points Microsoft External Staff
    2025-07-09T08:12:32.5466667+00:00

    Hi Simon,

    This error seems to be specifically about a project-level import trying to import 'app.config' as a namespace, which is incorrect.

    You should try the following:

    1. Check Project-Level Imports

    In Visual Studio:

    • Right-click your project → Properties
    • Go to "References" tab
    • Look in the "Imported namespaces" section
    • You'll likely see a line with app.config or just app
    • Uncheck it or remove it

    2. Check .vbproj File Directly

    Edit the project file:

    • Right-click project → "Unload Project"
    • Right-click → "Edit [YourProject].vbproj"
    • Look for something like:
    <ItemGroup>
      <Import Include="app.config" />
    </ItemGroup>
    

    or

    <Import Include="app" />
    
    • Delete these lines
    • Save and reload the project

    3. Auto-Generated Import Issue

    Sometimes Visual Studio auto-generates this import incorrectly. Check:

    • Solution Explorer → Show All Files
    • Look for any hidden .vb files that might have this import
    • Check if there's a namespace called 'app' somewhere in your code

    4. IntelliSense/Auto-Complete Accident

    This often happens when:

    • You typed "app" and IntelliSense suggested "app.config"
    • You accidentally accepted it as an import instead of a file reference
    • It got added to project-level imports

    You might also consider creating a blank project with the same configuration to help isolate the issue. This can help determine whether the problem lies within that specific project or if it's a broader issue with Visual Studio itself.

    If the issue appears to be system-wide, I’d recommend doing a clean reinstall of Visual Studio to rule out any corrupted settings or components.

    If these steps didn't help you, please give me your full error message and a brief look of your project structure.


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.