views:

485

answers:

4

Hi All, Can anyone help me out, how to detect if MSXML parser is installed on a machine or not. I looked for a registry entry,but unable to get one. I am writing a VB.NET application. Thanks in advance :)

A: 

I would check if these files exists and check the version.

Or I would use this

Or maybe there is a better way?

Fredou
Thanks for the reply. The 2nd option looks useful, but I am not getting how can I make use of this in VB.NET application. I want to execute this in background.
Vijay Balkawade
A: 

If possible, target MSXML 3.0. It's included in all Windows operating systems starting with Win2k SP4, so there's usually no need to check for it's presence.

Anyway, if you are using VB.NET, consider using the System.Xml namespace instead. It is part of the .net framework, which is needed by your VB.NET application anyway.

Heinzi
Microsoft recommend targetting MSXML6 by default, with MSXML3 as the preferred fallback (this is the recommended advice in that blog entry you've linked to).
Chris J
@Chris: Thanks for pointing that out! I can understand that MS wants people to use the new library, but, personally, if I do not *need* any of the MSXML6 features, I'd stick to MSXML3, since (a) MSXML6 is not pre-installed on WinXP, (b) WinXP is still in widespread use, and (c) this means I'd have to test and maintain *twice* the code (both the MSXML6 and the MSXML3 version).
Heinzi
A: 
tyranid
ok.Please correct me, if I am getting it wrong. So, you mean to say, if any version of MSXML parser is installed on my machine, this code segment will create an instance. If MSXML parser is not installed on my machine it will not create an instance and will throw an exception.
Vijay Balkawade
Yes, basically if in this case MSXML3 is not installed then you will get an exception. You can also choose different progids to select specific versions for test. You could just look for the progids in the registry as well (say HKCR\MSXML2.DOMDocument) but that will not necessarily prove that the DLL is correctly installed.
tyranid
A: 

One thing to notice is that The use of MSXML is not supported in .NET applications since the GC inside MSXML is not compatible with .Net framework.

Samuel Zhang