Archive for the ‘XML’ Category

Cannot add Microsoft XML v6.0 “msxml6.dll” as COM reference in Visual Studio 2008

July 23, 2008

Why Can Fail?!

When adding Microsoft XML v6.0 “msxml6.dll”  as COM reference to my project in Visual Studio 2008. Visual Studio shows a yellow “!” exclamation mark and an error saying “The system cannot find the file specified” even though I tried to

1. Add through COM references
2. Directly point to the file in my “system32” folder
3. Copying the file to my local bin directory and adding the reference there.

I have Microsoft XML versions 2.6, 3.0, 5.0 and 6.0 installed and only v6.0 seems to exhibit this issue. Searched the net for more information but was so for was unable to find any related information regarding this issue.

Why Like That?!

After much frustration, finally found the answer in the registry. Looked for

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\6.0

Which was the GUID for MSXML v6.0

There were 2 value under this entry.

“PrimaryInteropAssemblyName”=”Microsoft.SqlServer.msxml6_interop, Version=6.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91”

“PrimaryInteropAssemblyCodeBase”=”D:\\Program Files\\Microsoft SQL Server\\90\\DTS\\Microsoft.SqlServer.msxml6_interop.dll”

It mentions that the Primary Interop Assembly for MSXML6 is already created and it is stored under

“D:\Program Files\Microsoft SQL Server\90\DTS\Microsoft.SqlServer.msxml6_interop.dll”

HOWEVER, the dll is actually stored in

D:\Program Files\Microsoft SQL Server\90\DTS\Binn\ Microsoft.SqlServer.msxml6_interop.dll

So (I am assuming) when VS 2008 tries to add the reference, it skips the compilation by tlbImp.exe since a primary Interop assembly is already registered, tries to look for it in the folder specified in the registry, but fails because it is not there.

I was able to replicate this on my colleague’s machines, so this seems to be a scripting error in SQL 2005 Server installer.  /facepalm

What To Do?!

So, to resolve this issue, you can either

a) correct the path in the registry  to the actual location

“D:\Program Files\Microsoft SQL Server\90\DTS\Binn\ Microsoft.SqlServer.msxml6_interop.dll”

or

b) delete the entry in the registry to force a recompilation every time the reference is added.

Cheers.