473,320 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to get a Primary Interop Assembly for a Microsoft COM component?

Hello,

We seem to need a PIA for MSXML 4. According to the documentation, only the
original publisher of a COM type library is supposed to create a .NET PIA.
As far as I know, Microsoft hasn't done that yet. Our problem is that we
very much want to create a PIA for a COM component of ours, but TlbImp.exe
/primary insists that all referenced dependencies be PIAs as well. Our
component has a type library reference to MSXML 4, hence the problem... I
presume many people run into similar problems with various MS COM
components. As a last resort, we'll make a PIA for MSXML 4. But PIAs are
supposed to be deployed in the GAC, which creates potential for conflicts
with unrelated application... Any help will be appreciated.

// Chango

NOTE: This post is from an anti-spam, non-existent email address. For
further communication, please reply to the Newsgroup and/or contact me
directly at my*********@hvltd.com.
Jul 21 '05 #1
8 9976
Hi Chango,

Thank you for posting. Regarding on the issue, I am
finding proper resource to assist you and we will update as soon as posible.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security(This posting is provided "AS IS",
with no warranties, and confers no rights.)

Jul 21 '05 #2
Hi Chang

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to create a PIA for MSXML4
COM. If there is any misunderstanding, please feel free to let me know.

Based on the following KB article, we can see that a COM type library that
is imported as an assembly and that is signed by someone other than the
original type library publisher cannot be a PIA. Only the type library
publisher can create a PIA that becomes the unit of official type
definitions for interoperating with the underlying COM types.

http://support.microsoft.com/?id=304295

So if you need to interop with the MSXML library, I think you can just
create a strong-named wrapper for it instead of making a PIA. Could you
please omit the /primary option and try the following statement?

TLBIMP C:\WINDOWS\system32\msxml4.dll /out:MyWrappers.dll /keyfile:mykey.snk

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #3
Hello Kevin,

Thanks for the response. Yes, so far we used a strong-named import of the
MSXML type library, but now the problem is that we have a very compelling
reason to make a PIA for our own COM component, which references MSXML. As I
explained before, TlbImp requires all dependencies of a PIA to be PIAs too.

How do people deal with this problem in general? There are tens of popular
Microsoft COM APIs now used from .NET. The default importing of these type
libraries works just fine. So it would take Microsoft little effort just to
strong-name them and call them the "official PIAs"... Otherwise, we really
seem to be forced to break the PIA rules, or not be able to avail from them.

//

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:Br**************@cpmsftngxa10.phx.gbl...
Hi Chang

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to create a PIA for MSXML4
COM. If there is any misunderstanding, please feel free to let me know.

Based on the following KB article, we can see that a COM type library that
is imported as an assembly and that is signed by someone other than the
original type library publisher cannot be a PIA. Only the type library
publisher can create a PIA that becomes the unit of official type
definitions for interoperating with the underlying COM types.

http://support.microsoft.com/?id=304295

So if you need to interop with the MSXML library, I think you can just
create a strong-named wrapper for it instead of making a PIA. Could you
please omit the /primary option and try the following statement?

TLBIMP C:\WINDOWS\system32\msxml4.dll /out:MyWrappers.dll /keyfile:mykey.snk
HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #4
Hi Chango,

If your own COM component is referencing MSXML, you needn't create PIA for
MSXML. What you need to do is creating a PIA for your own COM. When the
users calls your PIA, the PIA calls your own COM component and the COM
references MSXML.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #5
Well, this is the crux of the problem: We can't generate our PIA, because
TlbImp insists all dependencies be PIAs too. Here's the actual command and
output:
tlbimp.exe WorXConverter.dll /keyfile:mykey.snk /verbose /primary
Microsoft (R) .NET Framework Type Library to Assembly Converter 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Resolving reference to type library 'MSXML2'.
TlbImp error: System.ApplicationException - Referenced type library 'MSXML2'
does not have a primary interop assembly registered.

If I first import MSXML4.dll [note the typelib name within is MSXML2] and
specify the reference explicitly on the TlbImp command line
(/reference:Interop.MSXML2.dll), the error message is consistent:

TlbImp error: System.ApplicationException - Referenced assembly
'Interop.MSXML2'
is not a primary interop assembly.

Can I possibly be missing something, or Microsoft should really publish PIAs
for popular COM type libraries in order to make the whole PIA idea work for
everyone else?

//

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:pi**************@cpmsftngxa10.phx.gbl... Hi Chango,

If your own COM component is referencing MSXML, you needn't create PIA for
MSXML. What you need to do is creating a PIA for your own COM. When the
users calls your PIA, the PIA calls your own COM component and the COM
references MSXML.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #6
Hi Chango,

I would like to know how your COM component is referencing to MSXML. From
the message, it seems that it is referring to an interop assembly of MSXML.
If you're working on a pure COM component, there needn't be any interop
relations between your COM and MSXML. So there will not be the PIA issues.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #7
It's a typical case: The original COM component uses the MSXML 4 API. To do
this, the IDL file contains the statement importlib("msxml4.dll"). This
results in a type library reference embedded in our type library. When
TlbImp.exe imports our type library, it sees the embedded reference to the
MSXML type library and tries to resolve it. The default behavior is to just
automatically generate an interop assembly for any referenced type library
(MSXML in our case) and reference that assembly in the interop assembly
generated for the main COM type library being imported. But as I showed you
in the previous post, this doesn't work if the /primary switch is used.

The HARD RULE seems to be that every explicit dependency of a PIA must be a
PIA too. So, we are back to the originally stated problem: Is there any
possible way for Microsoft to provide a PIA for MSXML 4 (and other popular
components too, in general)? Or is there something fundamental about how
these things are supposed to be working that I am still missing? Please
help...

// Chango

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:Zb**************@cpmsftngxa10.phx.gbl...
Hi Chango,

I would like to know how your COM component is referencing to MSXML. From
the message, it seems that it is referring to an interop assembly of MSXML. If you're working on a pure COM component, there needn't be any interop
relations between your COM and MSXML. So there will not be the PIA issues.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #8
Hi Chango,

In this case, no PIA for MSXML is needed. Let me explain this to you.
First, PIA is used for interop. It makes a managed assembly to call a COM
component. However, in this case, MSXML is called by a COM component
written by you. So there is no interop here. It's just one COM referencing
another COM.

So what we need to do is to build a PIA for your COM component. Since no
PIA is used for MSXML, you can build the PIA for your own COM successfully.

Furthermore, currently we don't have any PIAs for MSXML and I don't think
we will release such PIAs in the future.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: keefah | last post by:
Hi, I'm writing a C# web app that uses Outlook to send email. I use a reference to the Microsoft Outlook 11.0 Object Library, but it's giving me problems. I tracked down some stuff on the Net...
0
by: kunallalwani | last post by:
Hi friends, I had a functional requirement of my project to get the text content of any Microsoft Office (xp) related file and show it to the user. I downloaded the Office Xp Primary Interop...
8
by: Chango V. | last post by:
Hello, We seem to need a PIA for MSXML 4. According to the documentation, only the original publisher of a COM type library is supposed to create a .NET PIA. As far as I know, Microsoft hasn't...
3
by: Dustin van de Sande | last post by:
I'm developing a ASP.NET 2.0 web application which exports and imports Word documents. The functionality is implemented in a DLL project which is referenced by the web application. In the DLL...
7
by: R Reyes | last post by:
Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? I'm trying to manipulate MS Word from my Web Form application and I can't get passed...
0
by: R Reyes | last post by:
ISSUE (reposted) =========================== Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? For many people, they say they add the...
9
by: sajithkahawatta | last post by:
my web page C#.net is work properly in my iis .but when i publish in another server it give errers.i used vs2005 and ms word 2003. but in the server there is no vs2005 or word installed. it has only...
0
by: Luft | last post by:
I'm just starting to work with VSTO and Word 2007 but I've run into a problem when trying to create an add-in. I get the warning: This project references the primary interop assembly for Microsoft...
3
OuTCasT
by: OuTCasT | last post by:
Hi I have created an asp.net project that exports items from datagridview to and outlook calendar This is the code that i have used.. Dim body As String Dim ends As String ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.