Skip to content

Unable to load COM components in.NET 5.0 WPF  #4534

@lifuhua123

Description

@lifuhua123
  • .NET Core Version: .net 5.0
  • Windows version: win 10 x64
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: No
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? NO

Problem description:
An error occurs when I try to call an OCX control on an external device in.NET 5.0 WPF :“Could not find assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Either explicitly load this assembly using a method such as LoadFromAssemblyPath() or use a MetadataAssemblyResolver that returns a valid assembly.”
Actual behavior:

Expected behavior:

Minimal repro:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions