Original address: https://support.microsoft.com/en-us/kb/963017
Source: Microsoft Support
RAPID PUBLISHING
RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.
Action
You attempt to use a 64-bit component within the Microsoft Visual Studio Integrated Development Environment (IDE).
Result 1. When adding control contained within an external 64-bit assembly to to the Visual Studio Toolbox, you receive the following error message. "<Control Name.dll> is not a valid .NET module". 2. When dragging and dropping a UserControl defined in a 64-bit assembly to a Form in another project within the same solution, you receive the error: "Failed to load toolbox item <UserControl Name>. It will be removed from the toolbox." 3. When opening the Visual Studio Windows Form Designer for a form that attempts to instantiate a control in a 64-bit assembly, you receive the following errors in the Windows Form designer. "Could not find type <typename>. 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." "The variable <variable name> is either undeclared or was never assigned. " Call Stack:
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)
Cause
This behavior is by design. Visual Studio is a 32-bit process, and therefore can only execute 32-bit modules. While Visual Studio allows you to add a reference to a 64-bit assembly, it cannot actually JIT compile it to 64-bit and execute it in process.
Resolution 1. Rebuild the assembly using the "AnyCPU" setting. This would allow the component to run within a 32-bit process (such as Visual Studio), or in a 64-bit process.
Advanced Compiler Settings Dialog Box (Visual Basic)
http://msdn.microsoft.com/en-us/library/07bysfz2.aspx /platform (Specify Output Platform) (C# Compiler Options)
http://msdn.microsoft.com/en-us/library/zekwfyz4.aspx If you are using a third party component and cannot rebuild it yourself, contact the component vendor to see if an "AnyCPU" version of the assembly is possible to obtain. This will allow the component to Just-In-Time (JIT) compile to run as either a 32-bit or 64-bit module, depending on the machine architecture the operating system and host process are targeting. 2. Add the assembly as a reference and load the control dynamically at run-time. Although you still would be unable to use the control within any designer inside Visual Studio, you can still write the code needed to instantiate the control and set it‘s properties accordingly. More Information
Is there a 64-bit version of Visual Studio 2005 or Visual Studio 2008? http://support.microsoft.com/default.aspx/kb/951801 Process Interoperability
http://msdn.microsoft.com/en-us/library/aa384231(VS.85).aspx DISCLAIMER
MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEBSITE (THE “MATERIALS”) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.
Properties
Article ID: 963017 - Last Review: 01/19/2009 20:39:01 - Revision: 1.1 Applies to
Microsoft Visual Studio 2005 Express Edition
Microsoft Visual Studio 2005 Professional Edition
Microsoft Visual Studio 2005 Service Pack 1 Microsoft Visual Studio 2005 Standard Edition
Microsoft Visual Studio 2005 Team Edition for Software Developers
Microsoft Visual Studio 2005 Team Suite
Microsoft Visual Studio 2008 Academic Edition
Microsoft Visual Studio 2008 Professional Edition
Microsoft Visual Studio 2008 Service Pack 1 Microsoft Visual Studio 2008 Standard Edition
Microsoft Visual Studio Team System 2008 Development Edition
Microsoft Visual Studio Team System 2008 Team Suite
Keywords:
kbnomt kbrapidpub KB963017
Cannot add Controls from 64-bit assemblies to the Toolbox or use in designers within the Visual Studio IDE