skip to Main Content

I am getting this error message

Warning IDE0130 Namespace "StockPortal" does not match folder
structure, expected "StockPortal."

but the namespace is correct. Any solution for this?
Please refer to the below screenshot as well
enter image description here

2

Answers


  1. It’s just a warning and asking the user to have the namespace matching with the same folder name. This warning can be ignored. It’s recommended to use the namespace matching with the folder hierarchy so that it becomes easy the get the location of file in the folder structure. And when user creates new file inside any folder using VS template, it creates the file with the folder structure namespace by default. It’s recommended but optional.

    In your case there is no folder named as StockPortal in the StockPortal project and if the file is located in StockPortal folder and if you’re using the namespace StockPortal.StockPortalthen warning will go away.

    Buy Program.cs is generally under root folder of source code.

    Login or Signup to reply.
  2. I have had this problem too for a while. I have .NET SDK 5.0.404 installed with VS 2019, 16.11.8, latest.

    It is mentioned here:

    and here:

    The issue (first one) is closed but people still experience problems.

    Until it is fixed I solve it by adding the following to the project-file:

    <Project ...>
        ...
        <PropertyGroup>
            ...
            <NoWarn>IDE0130</NoWarn>
            ...
        </PropertyGroup>
        ...
    </Project>
    

    Hope that helps until it is fixed.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search