Intellisense for XML config files broken in VS 2008?

Security Briefs

Syndication

I remember having trouble in VS 2005 with Intellisense not working - the trick back in those days was to remove the namespace declaration that was added by various tools. As long as the content was in no namespace, Intellisense seemed to work.

In VS 2008, Intellisense for config files was working great for me until recently, and now, regardless of whether I have the namespace or not, it appears hopelessly broken. I checked under XML|Schemas to see if the schema was in place, and indeed I have DotNetConfig.xsd listed in there for an empty namespace, and it's got the little green checkmark by it, which makes me think VS recognizes that this is the schema it's supposed to use, but still no joy. There are a few other schemas listed here (DotNetConfig30.xsd, for example), but none of those have checks by them - only DotNetConfig.xsd is checked.

Has anyone else seen this?


Posted May 22 2008, 08:55 AM by keith-brown
Filed under:

Comments

Aaron Skonnard wrote re: Intellisense for XML config files broken in VS 2008?
on 05-23-2008 4:06 PM
You might want to check what .NET version your project is currently targeting...I've seen this where intellisense breaks in 2008 if the project is still targeting an older version. If you target 3.5, it may begin working again.
Andreas Andreou wrote re: Intellisense for XML config files broken in VS 2008?
on 05-29-2008 5:43 AM
This is probably because you have as target framework 3.5, if this is the case then you need to add the following line in catalog.xml

<Association extension="config" schema="%InstallRoot%/xml/schemas/dotNetConfig30.xsd" condition="%TargetFrameworkVersion% = 3.5" />

..and replace the last association with:

<Association extension="config" schema="%InstallRoot%/xml/schemas/dotNetConfig.xsd" condition="%TargetFrameworkVersion% != 2.0 and %TargetFrameworkVersion% != 3.0 and %TargetFrameworkVersion% != 3.5" />
Keith Brown wrote re: Intellisense for XML config files broken in VS 2008?
on 05-29-2008 6:08 AM
Andreas,

Ahh, so *that's* how they map those chameleon schemas, based on file extension. I wondered how that worked. Alas, my catalog.xml already looks like what you suggest:

condition=%TargetFrameworkVersion% != 2.0 and %TargetFrameworkVersion% != 3.0

already maps onto

%InstallRoot%/xml/schemas/dotNetConfig.xsd

and still no joy :-(
Andreas Andreou wrote re: Intellisense for XML config files broken in VS 2008?
on 05-30-2008 1:41 AM
well Keith your catalog.xml looks like:

condition=%TargetFrameworkVersion% != 2.0 and %TargetFrameworkVersion% != 3.0

that condition should be:

%TargetFrameworkVersion% != 2.0 and %TargetFrameworkVersion% != 3.0 and %TargetFrameworkVersion% != 3.5

also you have to add the following association as well:

<Association extension="config" schema="%InstallRoot%/xml/schemas/dotNetConfig30.xsd" condition="%TargetFrameworkVersion% = 3.5" />
Keith Brown wrote re: Intellisense for XML config files broken in VS 2008?
on 05-30-2008 3:32 AM
I rejiggered things the way you suggest, and now the .net 3.0 schema file is selected with the little green checkbox in the Xml Schemas dialog (instead of the normal .net schema file) when I target 3.5. But unfortunately it doesn't matter which one is selected, I still get no intellisense at all.

Thanks for taking the time to help! When I get some spare cycles I'm going to perform a repair of VS 2008 and see if that helps.
CGomez wrote re: Intellisense for XML config files broken in VS 2008?
on 05-30-2008 10:15 AM
I happened to see this and was reminded of your blog post:

Workaround: Installing Win SDK after VS2008 breaks XAML Intellisense

http://blogs.msdn.com/windowssdk/archive/2008/02/22/workaround-installing-win-sdk-after-vs2008-breaks-xaml-intellisense.aspx

Add a Comment

(required)  
(optional)
(required)  
Remember Me?