Every time I do a git pull from remote to update my branch, Visual Studio 2017 shows "the type or namespace could not be found" error in many files as I open them. Interestingly I don't see the problem in Visual Studio 2015 for the same projects/repo. The software builds fine in both versions of Visual Studio so it is a false error. Doing a Clean or Rebuild doesn't fix the problem. I end up re-cloning the repo from remote and then Visual Studio 2017 is happy. Any one knows how to fix this annoying problem?
To add an imported namespaceIn Solution Explorer, double-click the My Project node for the project. In the Project Designer, click the References tab. In the Imported Namespaces list, select the check box for the namespace that you wish to add. In order to be imported, the namespace must be in a referenced component.
A type or namespace that is used in the program was not found. You might have forgotten to reference (References) the assembly that contains the type, or you might not have added the required using directive. Or, there might be an issue with the assembly you are trying to reference.
If you hover your mouse over the red line under GridLayoutGroup (provided you use visual studio as your IDE) then a light bulb should appear. Hover your mouse over the light bulb, you will have an option like "Using UnityEngine. UI" click on it and your problem will be solved.
The problem is the package-restore. If it fails, you get the issue. You can try to unload and reload the projects, but I also still haven't found a way to avoid it.
Unloading and reloading the project did not work work me.
Instead, I delete the hidden .suo file inside the project directory and everything started working again. The path is:
(project name) \ .vs \ (project name) \ v15 \ .suo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With