简体   繁体   English

当我在.csproj文件中使用通配符时,为什么Intellisense在VS2010中不起作用?

[英]Why doesn't Intellisense work in VS2010 when I use wildcards in my .csproj file?

Steps to reproduce: 重现步骤:

  1. Create a new C# console project. 创建一个新的C#控制台项目。
  2. Write some code: 写一些代码:

     class Foo { } class Bar { Foo x; } 
  3. Observe that in Foo x; Foo x;观察到Foo x; the class name is highlighted. 类名称突出显示。 Intellisense will work for classes in this assembly. Intellisense将适用于此程序集中的类。
  4. Edit the .csproj file to include "**\\*.cs" instead of "Program.cs", to include all .cs files in the project directory and its subdirectories. 编辑.csproj文件以包含“** \\ * .cs”而不是“Program.cs”,以包括项目目录及其子目录中的所有.cs文件。
  5. Reload the project when prompted. 出现提示时重新加载项目。
  6. 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. 注意到C#文件仍然是加载的并且是项目的一部分,但Intellisense和语法突出显示不再识别此程序集中声明的任何类型或未安装在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. 我想使用通配符,以便更容易在Visual Studio IDE之外添加新文件。

I still don't know why this happens, but I did find out how to fix it: replace **\\*.cs with .\\**\\*.cs and as if by magic, it all works. 我仍然不知道为什么会发生这种情况,但我确实找到了如何修复它:用.\\**\\*.cs替换**\\*.cs.\\**\\*.cs 魔术一样,一切正常。 Hope that helps somebody else! 希望能帮助别人!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM