In our WPF application, code that was written weeks ago and did not exhibit the error now shows the IntelliSense error:
The name "foo" does not exist in the namespace "clr-namespace:bar"
where "foo" is any object defined in the default project namespace. The project builds and runs without issue, but IntelliSense insists that there is an error, and therefore none of the visual tools work (designer shows "Build the Project to update the Design view", no properties are shown for elements selected in the XAML code.
The main application is a WPF/C# project, but we link with unmanaged C++ code (image processing with OpenCV 64-bit) through a managed C++ wrapper.
Both Visual Studio 2017 and 2015 exhibit the issue (didn't try anything older).
There are a number of similar questions about this error, and even some answers that come close, but I was not able to resolve the issue with any of the answers I found previously.
Some of the things I tried:
- Rebuild solution (both using "Rebuild" as well as "Clean" and "Build")
- Restart Visual Studio
- Comment out offending code, rebuild, uncomment and rebuild
- Rebuild solution and projects (both by adding existing projects and copy / pasting code into new files)
- Deleting the .suo file
- Changing platform type and rebuilding*
*: as I'm posting this in order to save someone else from wasting 3 days of productivity, I can say that the solution turned out to be related to the platform type. Due our linking to a 64-bit library, the platform type of the C# project was set to x64. Several answers (here, here) suggest switching to x86, rebuilding, and then back to x64, which did work, but only until the solution was closed. Upon reopening the solution or restarting VS, the issue returned.