Addressing the MSB3304 warning during VB.NET compile

Randy Galbraith 16 Reputation points
2021-02-08T23:04:48.433+00:00

Recently during a routine compile of our VB.NET application we ran into this warning:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(2729,5):
warning MSB3304: Could not determine the dependencies of the COM reference "Microsoft.Office.Interop.Outlook".
Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND))
[C:\<path-to>\Base.vbproj]

This appears to be related to this section in Base.vbproj:

<COMReference Include="Microsoft.Office.Interop.Outlook">
<Guid>{00062FFF-0000-0000-C000-000000000046}</Guid>
<VersionMajor>9</VersionMajor>
<VersionMinor>4</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
</COMReference>

Any suggestions on how to resolve this or direction to take my research will be appreciated. I have build this application many times over the years and nothing in this area has changed recently.

Kind regards.
-Randy Galbraith

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,578 questions
Outlook Management
Outlook Management
Outlook: A family of Microsoft email and calendar products.Management: The act or process of organizing, handling, directing or controlling something.
4,900 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Karen Payne MVP 35,036 Reputation points
    2021-02-09T16:49:18.46+00:00

    Sound like you are adding a reference via COM (and may be wrong), try from Assemblies e.g.

    65934-11111111111.png

    0 comments No comments

  2. Randy Galbraith 16 Reputation points
    2021-02-09T21:02:08.607+00:00

    Hi Karen Payne.

    Thank you so much for your response. Your suggestion does appear to work, however some questions remain. In Visual Studio 2017 I went into References and deleted Microsoft.Office.Interop.Outlook. I then added it back as you suggested. This resulted in the following update to my .vbproj file:

    <Reference Include="Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
    <SpecificVersion>False</SpecificVersion>
    <EmbedInteropTypes>True</EmbedInteropTypes>
    <HintPath>..\Bin\Microsoft.Office.Interop.Outlook.dll</HintPath>
    </Reference>

    Although MSB3304 no longer appears, what does replacing <COMReference> with <Reference> mean for our project? As far as I can determine the <COMReference> that currently exists works for others. Indeed a fellow release engineer at our company just compiled this project yesterday without this warning.

    Although I seek answers to these questions I nonetheless want to thank you for your suggestion.

    Kind regards,
    -Randy Galbraith