[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Referencing COM DLL's from VS 2003 & 2005

Monty

3/22/2007 10:08:00 AM

I have a legacy COM application that has PIA's for it's DLL's that are
registered in the GAC. In VS 2003, I would add a reference to my project by
browsing to the DLL file in the install directory of my legacy app, and it
would automatically refer to the version in the GAC (this is good). In 2005,
when I add a reference to the DLL it creates an interop file for me (same
machine, same setup). How can I get 2005 to act like 2003 in this scenario?
If I add a reference directly to the PIA, it will let me declare an object
but will not let me instantiate the object.

TIA,
Monty


3 Answers

wawang

3/23/2007 7:19:00 AM

0

Hi Monty,

As far as I know, this behavior is not changed in VS2005. Did you call
"regasm" to register the PIA in your setup? Since you're installing the PIA
into GAC, there's no need to specify "/codebase" parameter to "regasm".

I've just tested it again on my side using following steps:

1) Created a simple VB6 ActiveX DLL "TestPIA1.dll"
2) Setup command prompt with VS2003 environment; run "sn -k v7.key"
3) Run "tlbimp TestPIA1.dll /primary /keyfile:v7.key /out:i7.TestPIA1.dll"
4) Run "gacutil -i i7.TestPIA1.dll"
5) Run "regasm i7.TestPIA1.dll"
6) Now create a new VS2003 and VS2005 project, try to add the reference to
"TestPIA1.dll"; then view "TestPIA1" properties from reference list, both
VS2003 and VS2005 show they're referring to the GAC version such as
"C:\WINDOWS\assembly\GAC\i7.TestPIA1\1.0.0.0__6c3a0ce1cdd19afe\i7.TestPIA1.d
ll".


Would you please try above steps and let me know the result on your side?
Thanks.

Sincerely,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default....
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/de....
==================================================

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


Monty

3/25/2007 4:32:00 AM

0

Hi Walter, thanks for your diligence. I went back to VS2003 and re-added
those references and now they are showing them (in the Properties window) as
being the located in the directory where I browsed to them rather than the
ones in the GAC. I'm SURE I saw it showing their location as being in the
GAC previously! Maybe I shouldn't have had those old mushrooms in the
fridge?

Anyway, I created my own Interops for them and am using those. Thanks again,

Monty


wawang

3/26/2007 2:50:00 AM

0

Hi Monty,

Thanks for the update.

Using your own interop assembly should be fine as long as the legacy COM
component is not shared between several processes and reference to it is
not passing around.


Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

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