Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / March 2007

Tip: Looking for answers? Try searching our database.

Referencing COM DLL's from VS 2003 & 2005

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Monty - 22 Mar 2007 11:07 GMT
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
Walter Wang [MSFT] - 23 Mar 2007 08:18 GMT
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.aspx#notif
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/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Monty - 25 Mar 2007 05:31 GMT
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
Walter Wang [MSFT] - 26 Mar 2007 03:50 GMT
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.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.