VB.NET strange behavior

  • Thread starter Thread starter Flavio Zanellato
  • Start date Start date
F

Flavio Zanellato

I've a strange anomaly in the way VB.NET
makes references of COM library :
- in one machine when i reference the Outlook 11 object library
the Object Browser displays the link as
'Microsoft.Office.Interop.Outlook'
- in the other development machine
(the same configuration : .NET framework, VS 2003, Office 2003, XP SP1,
etc)

the Object Browser displays the link as 'Outlook' only !

The problem :
in my code I wrote 'Imports Microsoft.Office.Interop.Outlook' ,
when i move the project files in the other machine, the code does not work
because of the 'Imports..' statement.
I must change it to 'Imports Outlook' to make project build.

What kind of behavior is this ???

Thanks for your response.
 
Hello,

Thanks for your post. As I understand, the problem you are facing is that
Outlook are under different namespaces when you add reference to it in
different systems. Please correct me if there is any misunderstanding. I
now share the following information with you:

Based on my experience and research, you may install PIA (Office Primary
Interop Assemblies) in some systems so that it will refer to
microsoft.office.interop.outlook.dll, while others don't. I believe that's
the reason why Outlook will appear in different namespaces. As you know,
you can refer to "References" section in Solution Explorer or Object
Browser to check the full name of Outlook to be imported in your source
code. Anyway, it will work properly regardless of namespace name of Outlook.

Office Primary Interop Assemblies
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/h
tml/wrrefofficeprimaryinteropassemblies.asp

How to: Install Office Primary Interop Assemblies
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/h
tml/wrtskinstallingofficeprimaryinteropassemblies.asp

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Ok, I checked out PIA and now the reference is correct
(the PIA assembly where not initially installed with Office 2003).
Only one question :
why in a machine the reference appears 'Microsoft.Office.Interop.Outlook
and in the other 'Outlook' only
(the assembly point at the same path) ?

Thank you very much for your answer.
 
Hi Flavio,

Thanks for your response. If you have PIA intalled, the
microsoft.office.interop.outlook.dll exists in GAC (global assembly cache)
and it will be referenced in your project with the namespace
"microsoft.office.interop.outlook". If PIA is not installed, Microsoft
Outlook 11.0 Object Library need to be converted to a CLR assembly when you
add reference to it with the namespace "Outlook" on the fly.

Does this answer your question?

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top