BUG: Controls are located at the upper-left corner of a form after you run the Visual Basic .NET 2002 Upgrade Wizard (831486)
The information in this article applies to:
- Microsoft Visual Basic .NET (2002)
SYMPTOMSOn a computer that has Microsoft Visual Studio .NET 2002
installed, you may install Microsoft .NET Framework version 1.1 in addition to
Microsoft .NET Framework version 1.0. After you run the Microsoft Visual Basic
.NET Upgrade Wizard to upgrade a Microsoft Visual Basic 6.0 project, all the
controls may be located at the upper-left corner of the form. Also, the Task
List window may contain multiple instances of the following design-time
error: Object type cannot be converted to target
type. This behavior only occurs at design time. At run time, all the
controls are in their original locations. CAUSEThe Visual Basic .NET Upgrade Wizard creates an XML-based
resource format (.resx) file for each of your Visual Basic 6.0 forms. This
.resx file contains a reference to the latest version of the
System.Windows.Forms.dll assembly. If you installed .NET Framework version 1.1
in addition to .NET Framework version 1.0 on your computer, the Visual Basic
.NET Upgrade Wizard adds a reference to version 1.0.5000.0 of the
System.Windows.Forms.dll assembly in the .resx file. However, Visual Studio
.NET 2002 loads a reference to version 1.0.3300.0 of the
System.Windows.Forms.dll assembly. Because of this difference in the assembly
versions, the Windows Forms Designer ignores the code that sets the Location property for each control. Therefore, each control is located at
the upper-left corner of the form.WORKAROUNDTo work around this bug, you may use either of the following
methods. However, Microsoft recommends that you create a configuration file for
the Visual Basic .NET Upgrade Wizard. Create a configuration file for the Visual Basic .NET Upgrade
WizardCreate a configuration file for the Visual Basic .NET Upgrade
Wizard. In the configuration file, specify the version of the common language
runtime for the Visual Basic .NET Upgrade Wizard to use as v1.0.3705. If you do this, the Visual Basic .NET Upgrade Wizard adds a
reference to version 1.0.3300.0 of the System.Windows.Forms.dll assembly in the
.resx file for each of your forms. To use this method to work around the bug,
follow these steps:
- In Windows Explorer, navigate to the folder that contains
the vbu.exe file. This file is typically located in the
following
folder:
%InstallationPath%\Microsoft Visual
Studio .NET\Vb7\VBUpgrade
Note %InstallationPath% is a placeholder for
the installation path of Visual Studio .NET on your computer. - In the folder that you located in the previous step, create
a file that is named vbu.exe.config. To do this, follow these steps:
- Start a text editor (such as Notepad).
- Type the following XML code in the text editor:
<configuration>
<startup>
<requiredRuntime version="v1.0.3705" safemode="true"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<publisherPolicy apply="no" />
</assemblyBinding>
</runtime>
</configuration> - On the File menu, click
Save.
- In the Save As dialog box, navigate to
the folder that you located in step 1.
- In the File name box, type
vbu.exe.config.
- Click Save.
- Run the Visual Basic .NET Upgrade Wizard to upgrade your
Visual Basic 6.0 project.
The behavior that is mentioned in the
"Symptoms" section of this article does not occur.
Edit the .resx file for your formEdit the .resx file for your form so that all the occurrences of
the Version attribute for the System.Windows.Forms.dll assembly match the
version of the assembly that Visual Studio .NET 2002 loads. To do this, follow
these steps:
- Use a text editor such as Notepad to open the .resx file
that corresponds to your form.
This file is located in the same
folder as your upgraded form file. - In the .resx file, locate all the occurrences of the
following value for the Version attribute:
1.0.5000.0 - Replace each occurrence of the code that you located in
step 2 with the following Version attribute value:
1.0.3300.0 - Save the .resx file, and then exit the text
editor.
- If your upgraded project is open in Visual Studio .NET,
close your solution, and then reopen the project.
If your upgraded
project is not open in Visual Studio .NET, open the project.
The
behavior that is mentioned in the "Symptoms" section of this article does not
occur.
STATUSMicrosoft
has confirmed that this is a problem in the Microsoft products that are listed
in the "Applies to" section.REFERENCESFor more information, visit the following Microsoft
Developer Network (MSDN) Web sites:
| Modification Type: | Major | Last Reviewed: | 3/20/2006 |
|---|
| Keywords: | kbvs2005swept kbvs2005doesnotapply kbvs2002sp1sweep kbDesigner kbwizard kbUpgrade kbCtrl kbControl kbWindowsForms kbForms kberrmsg kbbug KB831486 kbAudDeveloper |
|---|
|