views:

1531

answers:

3

I would like to Debug .NET Mobile Device Application using multiple instances of Device Emulator. If I right click the project and go to Debug -> Start new instance in Visual Studio 2008 when an instance is already running I get the error

Unable to copy file "obj\Debug\MyMobileApp.exe" to "bin\Debug\MyMobileApp.exe". The process cannot access the file 'bin\Debug\MyMobileApp.exe' because it is being used by another process.

Does anyone know if and how I can do this?

+1  A: 

I just discovered a way you can (sort of) do this. You can't deploy from two instances of Visual Studio to two instances of the same type of emulator, but you can deploy to instances of two different types of emulator. Although not without a small trick.

To see how this works, open two instances of Visual Studio, and open the same CF project in each. Next, you need to manually start two emulators. Find the file dvcemumanager.exe (it should be in C:\Program Files\Microsoft Device Emulator\1.0) and run it. To start an emulator, select it and then click Actions | Connect. For this example, start the regular emulator and the VGA emulator (and wait for them to fully come up, of course).

Back in Visual Studio, set one instance's deployment target to the regular emulator, and the other instance's target to the VGA emulator, and start each. Each app will be deployed to the appropriate already-running instance of the emulator.

You can't use this technique to run two versions of the same type of emulator, because there doesn't seem to be any way of doing that from the device manager interface. Also, you can't just start two instances of VS and set them to different emulators - I tried that and it doesn't work. For some reason the second one tries to deploy to the same emulator as the first, and you get the error you saw.

MusiGenesis
A: 

@MusiGenesis

Thanks for your answer. I did try you steps but it didn't seem to make any difference whether a ran the device emulator manager from the exe or from the Tools -> device emulator manager menu item in VS. I can only debug both projects simultaneously if I hit start debugging at roughly the same moment.

Maybe you could check this and edit your post. The idea of using two different platforms and connecting to both first does seem to work as long as you stop and start the debugging seesions togther, otherwise you get the same error.

Unable to copy file "obj\Debug\MyMobileApp.exe" to "bin\Debug\MyMobileApp.exe". The process cannot access the file 'bin\Debug\MyMobileApp.exe' because it is being used by another process.

Christopher Edwards
I just tried it again and it works, although I just noticed that I can only set a breakpoint and step through code in one of the running instances, so I'm not sure this technique will work for you anyway.
MusiGenesis
I think you can get rid of the error you're seeing by changing the output path in one of your VS instances.
MusiGenesis
A: 

I'm not sure I understand the question completely.

Can't you start multiple instances of Visual Studio for the same project with each instance connected to a different emulator debugging the same application?

Shane Powell
Nope. That doesn't work. I think I ended up running one in a VM.
Christopher Edwards