dotnet / docs-desktop

This repository contains .NET documentation related to Windows Forms (winforms) and Windows Presentation Foundation (WPF).
Creative Commons Attribution 4.0 International
193 stars 174 forks source link

Error in code example #1193

Open jgold6 opened 2 years ago

jgold6 commented 2 years ago

The code example on step 9 of the To host the ActiveX control section has an error.

The line: WmpAxLib.AxWindowsMediaPlayer axWmp = new WmpAxLib.AxWindowsMediaPlayer(); Should be: AxWMPLib.AxWindowsMediaPlayer axWmp = new AxWMPLib.AxWindowsMediaPlayer();

At least I had to make that change or the above type would not resolve.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

adegeo commented 2 years ago

@jgold6 Thank you for reporting this. I confirmed this is true. Can you let me know what version of Visual Studio you're using? I'm using VS2022 and I had to also edit the com references in the project to disable embedding: <EmbedInteropTypes>false</EmbedInteropTypes>

Are you using a classic Framework project type or the newer SDK project types?

jgold6 commented 2 years ago

@adegeo I used a classic .NET Framework 4.6.1 project type in VS 2019 (latest build), not using the SDK project type.

adegeo commented 2 years ago

Thank you for confirming. Must be something you have to set on the new SDK Project type