简体   繁体   中英

Cannot show Designer view of form containing Windows Media Player object in VS 2019 C#

I have a form in a C# VS 2019 project which contains a Windows Media Player object. When I try and view it in design view I get the error

'Could not find type 'AxWMPLib.AxWindowsMediaPlayer'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU.'

Windows Media Player was not present in the Toolbox when viewing another form without a Media Player Object, so I added it from the COM tab. It then appeared in the Toolbox but without an icon. If I drag it onto the new form I get the error AXHost not found.

If I look in VS Object Browser I can see AxWMPLib.AxWindowsMediaPlayer and its properties OK.

The project containing the form builds for platform AnyCPU (64 bit not available as an option) and runs OK. How can I see the form containing the Windows Media Player object in Design view?

Turns out that the Build options (Any CPU, Mixed Platforms,x86 and Configuration Manager) shown at the top of the screen to the right of the Debug etc Dropdown are not the same as those shown in the Project-> Properties->Build->Platform Target. The option shown was x64, even though Any CPU was shown at the top of the screen. Changing this to Any CPU allowed the Designer for the form to be viewed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM