I just finished restructuring and upgrading a bunch of C# projects from Visual Studio 2008 to Visual Studio 2010. Additionally, all of the projects were changed to target the .NET 4.0 runtime. Everything builds successfully but, I now get a bunch of warnings related to a COM reference that my application is dependent upon. One of the warnings is below. I get close to 100 warnings similar to the one below everytime I build the solution.
Warning 60 Type library importer encountered a property getter 'ClearTopCardQue' on type 'FuelDirectOLETLB.FuelDirectOLE' without a valid return type. The importer will attempt to import this property as a method instead. c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 1558 9 FDServer
I have called the 3rd party vendor that authored the object I am referencing to no avail. They advised me to make sure that I am targeting x86 which I am. They also stated that I should be able to build my projects against any version of the .NET runtime. Personally, I suspect that it has something to do with the fact that I am referencing a version 1 type library in Visual Studio 2010 / .NET Runtime 4.0 whereas before I was building on VS 2008 / .NET Runtime 3.5. I have tried building against all build configurations (i.e. x86, x64, Any Cpu) and tried every version of the runtime back to 2.0. The warnings concern me because I am not sure what they indicate. Can someone make any suggestions/recommendations that might help me locate the cause of these warnings?
It is a benign warning, nothing to worry about. They just didn't author the IDL for the component properly. Property getters in COM are methods, just like they are in .NET. The method must have the proper signature and attributes to be considered a valid property that can be directly translated to a .NET property.
This is fumbled sometimes. A good example is Windows Media Player. Run this command from the Visual Studio Command Prompt in a temporary directory:
And you'll see:
Next type:
Which decompiles the type library back to IDL. Select the text in the right pane and copy/paste it into a text editor. Locate "sessionPlaylistCount" and you'll see:
When you compare it with other properties you'll see the mistake, they forgot the [retval] attribute.
It isn't a problem because Tlbimp.exe will simply make it a method instead of a property. You'd write
get_sessionPlaylistCount(out count)
to use the broken property. It is inconvenient because the syntax is awkward but not otherwise a problem.How to remove warning message (wmp.dll)?
Old question but the issue remains:
Even though the warning message can be ignored but its annoying to have it in error list. What worked to remove this warning for both
x86
andx64
;I added a reference to a different build of Windows Media Player and no more warning or errors for both CPU architecture.
This worked perfect on
Windows 10
; can't be sure about other environments.There was slight modification for the code to fit the 'new' reference. If you don't need the build that brings the warnings specifically you could try this out. Please refer to attached images,
Build 12.0.10011.x
worked for me.