Product is a namespace but is used as a type

Asked

Viewed 1,458 times

2

I have this error message:

Product is a namespace but is used as a type

It was working and when I arrived to compile, I’m picking up this error. How do I fix this?

  • If it already worked, you must have put a new path in the using section in your class that has a folder or file called Product and this causes the VS to get lost in which Product to use and launches this error

  • 2

    OOOOU, you have a namespace of the same class name. example namespace Timetest { class Timetest { }

  • Post your class and the implementation that the answer will come in a matter of minutes. If you cannot change the structure you can use an alias to get around the situation.

  • @pnet vc need to post the error line in question, containing your code.

1 answer

3

You have a namespace in your project called product, as well as your class.

Probably some folder called product you added. Change the name of the folder to Products in the plural and change the Product namespace of the files inside that folder also to its plural Products

  • I claim that the problem is in my VS2017. I downloaded another project, added what I had done and it worked. I don’t know what happened, but it’s working. I think you have something and I don’t know what it was and how it’s already working, I let it go. Fabri, that’s what I thought too. I looked in Solution and could not see anything. In this task I just added the namespace Newtonsoft and the System Net. and nothing else.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.