Steps to reproduce:
- Create a new C# console project.
-
Write some code:
class Foo { } class Bar { Foo x; } - Observe that in
Foo x;the class name is highlighted. Intellisense will work for classes in this assembly. - Edit the .csproj file to include “**\*.cs” instead of “Program.cs”, to include all .cs files in the project directory and its subdirectories.
- Reload the project when prompted.
- Observe that the C# file is still loaded and part of the project, but that Intellisense and syntax highlighting no longer recognise any types declared in this assembly or in 3rd party assemblies that are not installed in the GAC.
Why does this happen? I would like to use wildcards to make it easier to add new files outside of the Visual Studio IDE.
I still don’t know why this happens, but I did find out how to fix it: replace
**\*.cswith.\**\*.csand as if by magic, it all works. Hope that helps somebody else!