This is what I found works to suppress this warning, based mostly on comments here: https://social.msdn.microsoft.com/Forums/vstudio/en-US/7a7c352b-20cb-4931-b3b5-27e899016f75/turning-off-msbuild-warnings-msb3305?forum=msbuild
Relevant details posted by IanG:
Although in general, fixing the underlying problem is the best way to
fix warnings, that's not possible when the underlying 'problem' is
that the Microsoft-supplied build tooling dislikes something about a
Microsoft-supplied library.
...
The difficulty here is that the 'problem' that MSBuild is identifying
here isn't truly a problem at all. It's just telling us that the
imported library contains some features which, if you chose to use
them, would be problematic in a .NET world. Unfortunately, it
generates those warnings even if your code doesn't use any of those
problematic bits. This is perfectly normal when importing type
libraries that weren't designed with .NET in mind. And as long as your
C# code never attempts to use those features you'll be fine.
...
I've found a way to stop the warnings from appearing, but I'm not sure
how reliable it is, because it uses a feature for which the I've not
found any direct documentation, and the only related thing I've found
carries this warning: "This API supports the .NET Framework
infrastructure and is not intended to be used directly from your
code."
I've added this in the PropertyGroup at the top of my .csproj file:
<ResolveComReferenceSilent>True</ResolveComReferenceSilent>
I've not been able to find this documented directly, but looking at
the targets files in the SDK, you can see that this affects the
following property:
http://msdn.microsoft.com/en-us/library/microsoft.build.tasks.resolvecomreference.silent(v=vs.110).aspx
but that's the one with the warning that this is for internal use.
That said, I'm not using the unsupported setting directly: I'm using
it via this property. And although I've not found any docs for the
property itself, there is at least one page that tells you about the
property. Although it's for a quite different kind of project,
http://msdn.microsoft.com/en-us/library/windows/hardware/jj659905(v=vs.85).aspx
does recommend using this to remove spurious warnings from a COM
reference.
One of those links takes you to Sharing compiled binaries between UWP apps and Desktop apps which tersely just says:
If you see warnings as a result of COM references, add the following
to the <PropertyGroup>
tag:
<ResolveComReferenceSilent>true</ResolveComReferenceSilent>
Even though this is UWP-specific information, it seems to work fine in non-UWP projects.
To implement this in my own project, I added a new PropertyGroup
below the existing COMReference
section of the CSPROJ
file:
<ItemGroup>
<COMReference Include="SomeVB6Library">
<Guid>{.......}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<PropertyGroup>
<!-- ResolveComReferenceSilent is to remove warning MSB3305 -->
<ResolveComReferenceSilent>true</ResolveComReferenceSilent>
</PropertyGroup>
Note that for whatever reason I was not seeing the warning generated every time I built the library, only sometimes. But it did seem to consistently appear whenever I cleaned & then rebuilt the entire solution. Until I realized that I wasn't convinced whether this had worked as intended or not. But it appears that it did.
I am not sure if this could have any other undesired effects - like suppressing other warnings that you might actually need to see. I would test carefully.