473,386 Members | 1,773 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,386 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 9986
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.