tags:

views:

360

answers:

0

We are getting the error message noted in the subject line. It just started today.

Environment:

  • OS - WinXP SP3 with all the latest updates.
  • Visual Studio 2008 with all the latest updates.

Steps to recreate the problem:

  1. Open Visual Studio and create a VB Class Library project. Add the following property and property method to Class1:

    Protected mProperty1 As String

    Public Property Property1() As String Get Return mProperty1 End Get Set(ByVal pProperty1 As String) mProperty1 = Left(pProperty1, 100) End Set End Property

  2. Compile the project.

  3. Open a second copy of Visual Studio and create a VB Windows Application project.

  4. Add a reference to \Projects\ClassLibrary1\bin\debug\ClassLibrary1.dll

  5. Compile the project.

  6. Alt-tab to the Class Library project and change the Left(pProperty1, 100) to Left(pProperty1, 50).

  7. Compile the project.

  8. Alt-tab to the Windows Application project.

  9. The error list shows two errors:

Error 1 Unable to load referenced library 'D:\Visual Studio 2008\Projects\ClassLibrary1\bin\Debug\ClassLibrary1.dll': The process cannot access the file because it is being used by another process.

Error 2 Unable to load referenced library 'D:\Visual Studio 2008\Projects\ClassLibrary1\bin\Debug\ClassLibrary1.dll': The process cannot access the file because it is being used by another process. D:\Visual Studio 2008\Projects\ClassLibrary1\bin\Debug\ClassLibrary1.dll

If I close the Windows Application project (leaving Visual Studio open) and re-open it, the error goes away and the project compiles.