Accessing legacy MSXML2 Interop DLL fails

This forum is meant for questions and discussions about the X# language and tools
Post Reply
Jan
Posts: 10
Joined: Wed Mar 16, 2022 8:19 am
Location: Germany

Accessing legacy MSXML2 Interop DLL fails

Post by Jan »

Hello,

we are currently migrating a project from Vulcan.Net to XSharp. It is containing a reference to the legacy Microsoft XML 6 DLL Interop.MSXML2.DLL.

In the migrated X# project, there is an MSXML2 (Microsoft XML 6, DLL name: Interop.MSXML2.dll) reference, and Intellisense does offer the members when I am typing MSXML2..

Nevertheless, the compiler throws an error:

Code: Select all

XS0246	The type or namespace name 'MSXML2' could not be found (are you missing a using directive or an assembly
Does anybody know how to access MSXML2 in X#?
User avatar
robert
Posts: 4529
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Accessing legacy MSXML2 Interop DLL fails

Post by robert »

Jan,
This sounds like a "USING " statement is missing.
What is the complete type name for the MSXML2 class ?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Jan
Posts: 10
Joined: Wed Mar 16, 2022 8:19 am
Location: Germany

Accessing legacy MSXML2 Interop DLL fails

Post by Jan »

Thank you, but I am using #USING already.

There is no difference whether I am writing #USING or putting "MSXML2." (or both) in front of the corresponding Object, though MSXML2 is the correct namespace, because that namespace worked in Vulcan.NET.

I made a screenshot, see attachment of this post with intellisense tooltip showing the members.
I am a bit confused about that...

XSharp Version is Cahors 2.9.1.1
Attachments
MSXML2.png
MSXML2.png (85.25 KiB) Viewed 1016 times
User avatar
Chris
Posts: 4922
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Accessing legacy MSXML2 Interop DLL fails

Post by Chris »

Hi Jan,

Please check also the warnings reported by the compiler, can you spot one or more related to the COM reference?
I gave it a short try here and I see that I get some warnings about failing to create a wrapper assembly for it, which is what I guess causes the problem.
.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Jan
Posts: 10
Joined: Wed Mar 16, 2022 8:19 am
Location: Germany

Accessing legacy MSXML2 Interop DLL fails

Post by Jan »

I'm getting two warnings:

Code: Select all

MSB3305	Processing COM reference "MSXML2" from path "C:WindowsSysWOW64msxml6.dll". At least one of the arguments for 'ISAXXMLReader.getBaseURL' cannot be marshaled by the runtime marshaler.  Such arguments will therefore be passed as a pointer and may require unsafe code to manipulate.

Code: Select all

MSB3290	Failed to create the wrapper assembly for type library "MSXML2". Access to the path 'objDebugInterop.MSXML2.dll' is denied.
The file exists and isn't write protected.
FFF
Posts: 1581
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Accessing legacy MSXML2 Interop DLL fails

Post by FFF »

It says "to the path", not "to the file" - do you have the necessary access rights?
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Jan
Posts: 10
Joined: Wed Mar 16, 2022 8:19 am
Location: Germany

Accessing legacy MSXML2 Interop DLL fails

Post by Jan »

I removed the reference and added a new reference to C:WindowsSysWOW64msxml6.dll instead, and now it is working.
Jamal
Posts: 320
Joined: Mon Jul 03, 2017 7:02 pm

Accessing legacy MSXML2 Interop DLL fails

Post by Jamal »

Hello Jan,

FWIW, you may have your reasons to use MSXML2 since you are using X#, why not use System.Xml namespace and classes?
They are well documented and built in the NET framework

Jamal
mk_schmid
Posts: 14
Joined: Wed Jul 06, 2022 1:53 pm
Location: Germany

Accessing legacy MSXML2 Interop DLL fails

Post by mk_schmid »

Hello,
the use of MSXML is not supported in .NET applications.
https://learn.microsoft.com/de-DE/troub ... pplication
I think you have to change to System.xml!

Christian
Christian Schmid
Post Reply