Deployment project build fails with VS2022, works with VS2019

Andrew Pepper 1 Reputation point
2021-12-16T08:49:48.293+00:00

Hi, I've a project which I've developed in VS2019 - and the deployment project builds without an issue with 2019. I've copied the project folder to a new folder and tried loading it into VS2022. The code part builds and I can run it in VS, but if I try and build the associated deployment project, I get two warnings about WMP:

Processing COM reference "WMPLib" from path "C:\WINDOWS\system32\wmp.dll". Type library importer encountered a property getter 'sessionPlaylistCount' on type 'WMPLib.IWMPNowPlayingHelperDispatch' without a valid return type. The importer will attempt to import this property as a method instead. FormbyFinder

and

Processing COM reference "WMPLib" from path "C:\WINDOWS\system32\wmp.dll". At least one of the arguments for 'IWMPGraphEventHandler.NotifyAcquireCredentials' cannot be marshaled by the runtime marshaler. Such arguments will therefore be passed as a pointer and may require unsafe code to manipulate.

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,503 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Jiachen Li-MSFT 24,431 Reputation points Microsoft Vendor
    2021-12-17T06:47:14.947+00:00

    Hi @Andrew Pepper ,
    It is a benign warning, nothing to worry about, this does not mean that your application will not run.
    Use Windows Media Player as an example. Run this command from the Visual Studio Command Prompt in a temporary directory:

      Tlbimp.exe c:\windows\system32\wmp.dll  
    

    And you'll see:

    TlbImp : warning TI0000 : Type library importer encountered a property getter 'sessionPlaylistCount' on type 'WMPLib.IWMPNowPlayingHelperDispatch' without a valid return type. The importer will attempt to import this property as a method instead.
    Type library imported to WMPLib.dll

    Next type:

      Oleview.exe c:\windows\system32\wmp.dll  
    

    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:

    [id(0x00000ba3), propget]
    HRESULT sessionPlaylistCount([out] long* pVal);

    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.

    Best Regards.
    Jiachen Li

    ----------

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Andrew Pepper 1 Reputation point
    2021-12-17T15:40:01.88+00:00

    Hi, thanks for the detailed reply; unfortunately, that didn't go quite the same as suggested: I did the tlmlmp command I got two different warnings:
    TlbImp : warning TI3012 : Type library importer encountered a property getter 'sessionPlaylistCount' on type 'WMPLib.IWMPNowPlayingHelperDispatch' without a valid return type. The importer will attempt to import this property as a method instead.
    TlbImp : warning TI3015 : At least one of the arguments for 'WMPLib.IWMPGraphEventHandler.NotifyAcquireCredentials' cannot be marshaled by the runtime marshaler. Such arguments will therefore be passed as a pointer and may require unsafe code to manipulate.
    TlbImp : Type library imported to WMPLib.dll

    When I tried the oleview command, I got a message box error - DllRegisterServer in IVIEWERS.DLL failed. The right hand pane is empty.


  3. Andrew Pepper 1 Reputation point
    2021-12-17T16:06:06.923+00:00

    I have managed to fix the problem; I added a new setup project to the solution and that builds successfully - so I guess the old setup project file had some issues! Thanks for your help.