Is Your Drag & Drop not Working?

If you’ve been developing in Azure you should be used to running Visual Studio as an administrator.  This is required when working with the Azure Compute & Storage emulators in IIS (as of Windows Azure SDK 2.1 you can bypass this by using Emulator Express although it comes with its own limitations).  

The other day while Azurifying one of our applications I noticed that you cannot drag & drop while running Visual Studio in administrator mode.  This this done on purpose by VS for security reasons (related to UAC).  Luckily there are a few workarounds.

Workaround #1:  Manually Copy & Toggle the Show All Files Icon

Open the project directory to manually copy over the files/folders you want to add and then use the Solution Explorer to unhide non-project files by clicking the "Show All Files" icon.  This will only toggle the files for the currently selected project.

ShowAllFiles_12-5-2013 9-05-22 PM.jpg

Then you can hold the Ctrl key, pick the files/folders you want, and right click selecting "Include In Project" from the context menu.

SelectFolders_12-5-2013 9-06-15 PM.jpg

IncludeInProject_12-5-2013 9-06-49 PM.jpg

When you’re done you can just toggle the "Show All Files" button again.

ToggleBack_12-5-2013 9-07-38 PM.jpg

Workaround #2: Install VS Commands Extension

You can also get around this issue by using a 3rd party Visual Studio extension called VS Commands.  After installing you will get 2 new menu entries under Tools > VSCommands called "Elevated Windows Explorer"  and "Directory Explorer".   Either of these will work by opening an elevated Windows Explorer window. 


ElevatedWindowsExplorer_12-5-2013 9-13-56 PM.jpg 

You can drag & drop normally from this window.

ElevatedWindow12-5-2013 9-22-14 PM.jpg