Hi, I'm working on several projects, using several instances of VS2005 on the same machine.

With most of my projects I can simply rebuild a project I have open and all the projects that reference the resulting library lose, and then regain, the interfaces during the build process.

That's fine by me, I'm actually pretty impressed that the response is so immediate, both to the loss of the file and the regain.

The problem is with only one of my projects, which correctly loses the interface to another library when that is rebuilt, but then says:

"Error 34 Unable to load referenced library <location>: The process cannot access the file because it is being used by another process."

Now, I can't really see what might still be using the file. All the other projects can cope with the rebuild, and I've just tried this out again with only the rebuild project and the problem project open and it still happens.

The error is, in fact, still registered if I close the rebuild project.

The error happens whenever I rebuild any project the problem project references, it is not simply limited to a single project being rebuilt.

Closing and reloading the problem project recovers from the error, as does deleting the reference and then recreating it, which is the workaround I'm using for the moment.

Does anyone know how to how to repair this one project that is having these problems



Re: Visual C# IDE Project is losing library files when they are rebuilt in another VS2005 instance

John Cunningham - MSFT

This is a project/solution issue, not a debugger issue. I am moving this to the C# forum. If your projects and solutions are in VB you should move this to the VB forum.

One potential reference holder may be the vshost program, you may want to switch that off.


Re: Visual C# IDE Project is losing library files when they are rebuilt in another VS2005 instance

Peter Ritchie

I'm going from the title of the thread; but, you're running two instances of VS 2005 and you're getting this error.

If that's the case, I would expect that. A particular instance of VS2005 isn't going to inform all other instances that it needs them to unload a reference to a particular assembly while it's doing a build. A single instance does this so it can actually build something.

If you want to be able to build, don't load two instances of VS2005 with two solutions that reference/build the same assembly.

Re: Visual C# IDE Project is losing library files when they are rebuilt in another VS2005 instance


As I said, it works fine with every other project I have in the chain.

I had assumed that recognising rebuids was a feature of the IDE. If it's just something that happens to work most of the time, but not all, then fair enough.

I find it odd, though, that the problem seem to be specific to a single project out of all of the projects I am using while others, some of which reference a larger number of projects than the one with problems, regain their references on every rebuild. If it's only working randomly in the first place, as you indicate, then I suppose inconsistent behaviour of that type is to be expected.