Closed lifuhua123 closed 3 years ago
@lifuhua123 Adding the WinForms reference to your project by edit your csproj file.
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>netcoreapp3.1;net5-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
</Project>
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: