Microsoft KB Archive/834610

= BUG: &quot;System.IO.FileIOException&quot; error message when you run a project that indirectly references the Microsoft.VisualBasic.Compatibility library in Microsoft Visual Basic .NET =

Article ID: 834610

Article Last Modified on 1/25/2006

-

APPLIES TO


 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual Basic .NET 2002 Standard Edition

-





SYMPTOMS
When you run a Windows application project that indirectly references the Microsoft.VisualBasic.Compatibility library from Microsoft Visual Studio .NET 2002, the reference lookup fails, and you may receive the following error message:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in system.windows.forms.dll

Additional information: File or assembly name Microsoft.VisualBasic.Compatibility, or one of its dependencies, was not found.



WORKAROUND
To work around the problem, follow these steps:  Create an application configuration file that is named App.config for the MyRTMClientApp.exe Windows application project that you create in step 3 of the &quot;More Information&quot; section.

For additional information about how to add the App.config file to the Windows application project, click the following article number to view the article in the Microsoft Knowledge Base:

822752 PRB: Application configuration file is deleted when you build the solution

  Add the following code to the App.config file:          </li> Double-click MyRTMClientApp.exe to run the Windows application project.</li></ol>

<div class="status_section">

STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.

<div class="moreinformation_section">

Steps to reproduce the problem
<ol> To build a Class Library project in Microsoft Visual Basic .NET 2002, follow these steps: <ol style="list-style-type: lower-alpha;"> Start Visual Studio .NET.</li> In Visual Basic Projects, create a Class Library project that is named MyRTMComponent.NET.</li> On the Project menu, click Add Reference.

The Add Reference dialog box appears.</li> On the .NET tab, click the Microsoft Visual Basic .NET Compatibility Runtime component, and then click the System.Windows.Forms.dll component.</li> In the Add Reference dialog box, click OK.</li>  Replace the existing code in the Class1.vb file with the following code: Public Class MyRTMClass

Public Function MyCollection As Microsoft.VisualBasic.Collection

End Function

Public Function MyDirListBox As Microsoft.VisualBasic.Compatibility.VB6.DirListBox

End Function

End Class </li> On the Build menu, click Build Solution to create the MyRTMComponent.NET.dll file.</li> Save the MyRTMComponent.NET Class Library project.</li></ol> </li> To create a Visual Basic .NET 2002 Windows application project, follow these steps: <ol style="list-style-type: lower-alpha;"> Start Visual Studio .NET.</li> In Visual Basic Projects, create a Windows application project that is named MyRTMClientApp.</li> On the Project menu, click Add Reference to add a reference to the MyRTMComponent.NET.dll file that you created in step 1 of this section.</li> In the Add Reference dialog box, click OK.</li> On the Project menu, click Add Reference to add a reference to the Microsoft Visual Basic .NET Compatibility Runtime component.</li> <li>In the Add Reference dialog box, click OK.</li> <li>On the Build menu, click Build Solution.</li> <li>Save the MyRTMClientApp Windows application project.</li></ol> </li> <li>To copy the Windows application project that you created in Visual Studio .NET 2002 to Visual Studio .NET 2003, follow these steps. <ol style="list-style-type: lower-alpha;"> <li>Copy the MyRTMClientApp Windows application project that you created in step 2 of this section. Put the MyRTMClientApp Windows application project under C:\ on a computer that has Visual Studio .NET 2003 installed.

Note The computer must not have Visual Studio .NET 2002 installed.</li> <li>Start Visual Studio .NET 2003.</li> <li>On the File menu, point to Open, and then click Project.</li> <li>Open the MyRTMClientApp Windows application that you put under C:\.</li> <li>Click Yes when you receive the message that prompts you if you want to update the MyRTMClientApp Windows application from Visual Studio .NET 2002 to Visual Studio .NET 2003.</li> <li>On the Build menu, click Build Solution.</li> <li>View the task list.

Notice the following errors:

Type ' ' is not defined.

The referenced component ' ' could not be found.

</li> <li>To solve the errors in step 3.g of this section, follow these steps: <ol> <li>In the Solution Explorer window, expand References.</li> <li>Right-click MyRTMComponent.NET, and then click Remove.</li> <li>Right-click References, and then click Add Reference to add the MyRTMComponent.NET.dll component that is located in the C:\MyRTMClientApp\bin folder.</li></ol> </li> <li>On the Build menu, click Build Solution.

Notice that the errors in the task list in step 3.g of this section do not appear.</li> <li>On the Debug menu, click Start.

You may receive the error message that is mentioned in the &quot;Symptoms&quot; section.</li></ol> </li></ol>

<div class="references_section">