开发者

How to: Programmatically detect if MSXML parser (version 3+) is installed or not

开发者 https://www.devze.com 2022-12-15 02:12 出处:网络
Can anyone help me out, how to detect if MSXML parser is installed on a machine or not. I looked for a registry entry,bu开发者_开发问答t unable to get one. I am writing a VB.NET application.

Can anyone help me out, how to detect if MSXML parser is installed on a machine or not. I looked for a registry entry,bu开发者_开发问答t unable to get one. I am writing a VB.NET application. Thanks in advance :)


One way you can do it is to create an instance of one of the MSXML objects in your code. e.g.

Dim t As Type
Dim o As Object

' If this code causes an exception the object doesn't exist t = Type.GetTypeFromProgID("MSXML2.DOMDocument") o = Activator.CreateInstance(t); System.Runtime.InteropServices.Marshal.ReleaseComObject(o)

I apologize if my vb.net code is bad :)


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

Or I would use this

Or maybe there is a better way?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号