HOW TO: Work Around "Sharing Violation" when Deploying a Smart Device Application from Visual Studio .NET 2003
Microsoft® .NET Compact Framework 1.0
Microsoft® Visual Studio® .NET 2003
IN THIS TASK
This article illustrates the cause of a sharing violation that prevents the deployment of your application from Visual Studio .NET 2003, and how to work around it.
A “sharing violation” prevents the deployment of a Smart Device Application, when attempting to deploy, run or debug a Smart Device Application from Visual Studio .NET.
------ Deploy started: Project: SmartDeviceApplication1, Configuration: Debug Pocket PC ------ Connected to Pocket PC 2002 Emulator (Pocket PC) running on X86. Copying files from 'C:\projects\SmartDeviceApplication1\bin\Debug' to '\Program Files\SmartDeviceApplication1' Copying SmartDeviceApplication1.exe Could not write to output file 'SmartDeviceApplication1.exe' - Sharing violation Error: The operation could not be completed ---------------------- Done ---------------------- Build: 1 succeeded, 0 failed, 0 skipped Deploy: 0 succeeded, 1 failed, 0 skipped
The most likely cause of this “sharing violation” is a previously running instance of the application on the target device or emulator. The default behavior for Pocket PC applications when closed is to minimize and remain in memory.
- Open the Control Panel on the device or in emulator; Start | Settings.
- Create a new Visual Basic Smart Device Application project named DetermineSender.
- Launch the Memory item from the System tab.
- Select the Running Programs tab.
- Select the application from the list and tap the Stop button.
- Setting the main form’s ControlBox property to False will cause the application to unload from memory when the form’s “X” button is tapped.
A debugged application instance is terminated when Stop Debugging is select from the Debug menu.
The Visual Studio .NET 2003 online help.