0

I want to add a 32-bit Custom Windows Forms Control into Visual Studio Toolbox in vs2022(64-bit). What I have tried: "Toolbox"->"choose items"->then import the "xxx.dll" as ".Net Framework components".However, it shows that the file "xxx.dll" is not valid.

Shyam Gupta(Senior Software Engineer, Windows Forms) says that the vs2022(64-bit) can't load the 32-bit resemblies/components, in the .net blog

some useful documents: document-1,document-2,document-3

2
  • 4
    You can't thats why it explicitly said in the blog you read and the contained links. If you must use an old 32 bit only Control then use the out-of-process designer also like its written in what you linked. And that one is simply not feature complete or on par with the embedded winforms designer. Commented Jun 6, 2024 at 10:18
  • It's just impossible. You can try to compile the source code into a x64 DLL. Commented Jun 7, 2024 at 6:55

1 Answer 1

1

Visual Studio 2022 is a 64-bit process and it cannot load 32-bit assemblies. Due to this technical limitation, Windows Forms .NET Framework in-process designer, which runs in the Visual Studio process, cannot load controls present in 32-bit assemblies. This has been a major Visual Studio 2022 adoption blocker for customers who have Windows Forms .NET Framework projects which utilize ActiveX/COM controls or other custom controls contained in 32-bit assemblies and which cannot be updated to AnyCPU or to .NET. Until now, such projects could only use Windows Forms designer in Visual Studio 2019 because it is a 32-bit process.

Previous versions of Visual Studio targeted 32-bit, and your project probably compiled to AnyCPU, which would pick 32-bit while in design mode to match Visual Studio. 32-bit specific references worked, but if you had a 64-bit specific reference, you might have run into a problem with the designer. With Visual Studio 2022, the problem reversed. Visual Studio 2022 is only available in 64-bit. Components and libraries that were compiled as AnyCPU work in both 32-bit and 64-bit and don't have an issue running in Visual Studio 2022 64-bit. But, after upgrading to Visual Studio 2022, your projects might fail to run at design-time if the project relies on a 32-bit specific component. This is even the case when your referenced component is compiled for AnyCPU, but happens to reference a 32-bit component or 32-bit COM\ActiveX library directly.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.