xsharp.eu • Accessing legacy MSXML2 Interop DLL fails
Page 1 of 1

Accessing legacy MSXML2 Interop DLL fails

Posted: Wed Mar 16, 2022 11:32 am
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#?

Accessing legacy MSXML2 Interop DLL fails

Posted: Wed Mar 16, 2022 1:36 pm
by robert
Jan,
This sounds like a "USING " statement is missing.
What is the complete type name for the MSXML2 class ?

Robert

Accessing legacy MSXML2 Interop DLL fails

Posted: Thu Mar 17, 2022 8:31 am
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

Accessing legacy MSXML2 Interop DLL fails

Posted: Thu Mar 17, 2022 8:52 am
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.
.

Accessing legacy MSXML2 Interop DLL fails

Posted: Thu Mar 17, 2022 9:55 am
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.

Accessing legacy MSXML2 Interop DLL fails

Posted: Thu Mar 17, 2022 10:07 am
by FFF
It says "to the path", not "to the file" - do you have the necessary access rights?

Accessing legacy MSXML2 Interop DLL fails

Posted: Thu Mar 17, 2022 12:23 pm
by Jan
I removed the reference and added a new reference to C:WindowsSysWOW64msxml6.dll instead, and now it is working.

Accessing legacy MSXML2 Interop DLL fails

Posted: Thu Mar 17, 2022 9:00 pm
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

Accessing legacy MSXML2 Interop DLL fails

Posted: Wed Mar 08, 2023 1:45 pm
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