Visual Studio does not let me drag drop items into it? - visual-studio-2010

Using Visual studio 2010 I got problems when double-clicking, for example a config file (*.config). Visual Studio would open but give me a error message about parameters. If I simple try to drag and drop a file that Visual Studio usually can read in to it, the icon will give me the "not possible icon"?
I have now installed Visual Studio 2012 and it has the same problem?!
This makes my work a lot harder, it should be easy to just drag & drop files into Visual Studio, but it's not so? Now I have to manually find the file with the file menu?
Please note, I have re-installed the computer before installing Visual Studio 2012.

On Windows Vista and newer Windows Explorer runs with medium integrity level.
If you run Visual Studio as administrator (high integrity level) then for security reasons OS will disable drag and drop from Explorer to Visual Studio.
You can either run Visual Studio as normal user or you can install VSCommands for Visual Studio 2012 extension. It has several features that can help with this such as:
Elevated Windows Explorer - small tool which looks like Windows Explorer but runs with elevated permissions allowing Drag And Drop
Directory Explorer - tool window inside Visual Studio which again looks like Windows Explorer and allows Drag And Drop
Run Visual Studio with medium integrity - allows Drag And Drop from Windows Explorer, but you won't be able to attach to processes run by other users (e.g. IIS)

If you run VS as administator, instead drag n drop, do copy (either ctrl+c, context menu "copy") the file selection in explorer and paste (ctrl+v, context menu) on selected node in VS

This was driving me nuts. In my Visual Studio solution I have two Web Application which use IIS as web server so because of this I have to always start my Visual Studio in Administrator mode. After starting as Admin I wasn't able to drag and drop files from Explorer to Visual Studio.
Solution:
Open Command Prompt as Administrator (Shortcut for Windows 8.1 is ⊞ Win + X + A)
Type "explorer" this would open Windows Explorer with Admin privileges.
And now you should be able to drag and drop any file from explorer to Visual Studio

If you disable UAC completely you can drag & drop from anywhere again. To do this you can't use the slider in the Control Panel because that only brings the UAC level down to 1. Make this registry change, reboot, and you can again use your computer like god intended.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"EnableLUA"=dword:00000000

I think the main goal of this question is how to add many folders and files to your project in a comfortable way. Drag and Drop files into your project is one solution, which fails under certain circumstances.
Another very easy way is:
Copy the new folders and files where you physically want them in your project
Open the project explorer in VS and click the button "Show all files"
All the folders and files, which are now not part of your project yet appear white
Select the the white folders or files, right-click and choose "Bind to project"
Done
This is also possible, if you run VS as admin.
Have some fun!
By the way: I found this question, because I had the same issue with drag and drop. I understand the security issues, but it is an annoying feature.

I'm using this easiest approach. When you run Visual Studio in Administrator Mode. When you need to drag and drop, just press CTRL+O to open up a file browser within visual studio, and use that file browser as an Elevated Explorer to do your drag and drop.

I had a similar problem but my issue was a bit different. I was trying to drag and drop a file from inside a zipped folder. Once I unzipped the folder drag & drop started working again.

I had this problem as well because I was opening VS in admin mode and the file explorer by default is not in admin mode.
Ended up creating a PowerShell and bat script to start explorer in admin mode every time the computer start.
admin.bat file:
#ECHO OFF
PowerShell.exe -Command "& {Start-Process PowerShell.exe -ArgumentList '-ExecutionPolicy Bypass -File ""%~dpn0.ps1""' -Verb RunAs}"
admin.ps1 file:
taskkill /f /im explorer.exe
start-process explorer.exe
The files just have to be in the same folder. Doesn't matter what they are called. Run the .bat file to restart explorer in admin mode or just create a shortcut to the .bat file in the startup folder ;) the script and ps1 file can be hidden.

On windows 8.1, change the registry key: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA and set value = 0.

Related

Make Visual Studio 2019 Always Run as Administrator from Start Bar Recent Solutions List

I recently upgraded to Windows 10 and Visual Studio 2019.
Prior to the upgrade, Visual Studio 2017 would always run as Administrator. I did not think much of this, but now that it is gone it is causing me problems.
The primary one is that it will not load my projects that use my local instance of IIS.
I usually launch Visual Studio from my start bar. Right now this goes like this:
Right click on the icon on the start bar and select my solution.
It loads and then I realize that the main project did not load.
Close visual studio, open as admin
Pick my solution and then it loads.
I would really like to only have to do #1 above. Is there someway I can edit the shortcut on the start bar to have it always launch as Administrator?
Turns out that Visual Studio uses different permissions when you click on the list of shortcut options it offers in the start menu. (IE to load a recent solution directly.)
Selecting the Properties->Advanced->"Run as Administrator" did not cause these to run as administrator.
But this did it:
Find devenv.exe (Visual Studio's executable)
Right Click on it and select "Troubleshoot Compatibility".
On the Program Compatibility Troubleshooter window, click on Troubleshoot Program
Check that the program requires additional permissions and click Next
On the next window, click on Test the program… and VS will open as administrator
Click next and then click on Yes, save these settings for this program
Now Visual Studio will ALWAYS run as administrator.
(Taken from: https://ppolyzos.com/2017/08/08/always-run-visual-studio-as-administrator/)

Visual Studio 2017 - Open in Visual Studio from Explorer - Permission Error

I am using VS 2017 Enterprise.
I have it setup to open/run in Administrator mode which is working for SLN files.
However I'm trying out the new "Open in Visual Studio" feature by right clicking on a folder in Explorer. I'm receiving the following permission error. It's happening for every folder I try.
VS Code has no problem however.
Is there something more I need to enable?
My first guess would be that the VS 2017 application itself (devenv.exe) is configured on that machine to always Run as Administrator see https://technet.microsoft.com/en-us/library/ff431742.aspx on how to change it:
To mark an application to always run as an administrator, do the following:
1. On the Start menu, locate the program that you want to always run as an administrator.
2. Right-click the application’s shortcut, and then click Properties.
3. In the Properties dialog box, click the Compatibility tab.
4. Do one of the following:
- To apply the setting to the currently logged-on user, select the Run This Program As An Administrator check box, and then click OK.
- To apply the setting to all users on the computer and regardless of which shortcut is used to start the application, click Change Setting For All Users to display the Properties dialog box for the application’s .exe file, select the Run This Program As An Administrator check box, and then click OK twice.
See also list of things that you can't do without administrator account https://msdn.microsoft.com/en-us/library/jj662724.aspx. What typically makes Web-developers to make VS always run as administrator is "Deploying a web application to Internet Information Services (IIS) on a local computer." and "Debugging applications that a run under a different user account, such as ASP.NET websites."
For me it has worked as it should, at least this can help you.
First question is how you "setup to open/run in Administrator mode" ?
Using the "Advanced button" of the Visual Studio 2017 shortcut is not enough because methods with the right mouse button don't use this shortcut.
Using the method of the compatibility tab as mentioned already by SergGr
(https://technet.microsoft.com/en-us/library/ff431742.aspx) has worked for me, and I have been able to use it for folders as well as for solution files !
I am logged in as a member of the local admin group and UAC standard setting into Win 8.1 .
Another possibility instead of using the compatibility page would be to inject an own manifest into devenv.exe. Neither of the two is very clean (I am no fan of the whole compat layer, but it helps here a bit).
Have you tried to switch UAC off temporarily for a test? Or how you have configured UAC?
If you have done it the way described, the explorer should come up with a correct UAC message.
This works for me if not for you then refer to (https://marketplace.visualstudio.com/items?itemName=GregTrevellick.OpeninVisualStudio2017Enterprise):
1. open notepad.exe and paste this into it:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\VSCode\command]
#="\"C:\\Program Files (x86)\\Microsoft VS Code\\Code.exe\" \"%1\""
here is my registry file exported just incase you need it (you shouldnt):
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\VSCode\command]
#=hex(2):22,00,43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\
00,46,00,69,00,6c,00,65,00,73,00,20,00,28,00,78,00,38,00,36,00,29,00,5c,00,\
4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,56,00,53,00,20,\
00,43,00,6f,00,64,00,65,00,5c,00,43,00,6f,00,64,00,65,00,2e,00,65,00,78,00,\
65,00,22,00,20,00,22,00,25,00,31,00,22,00,00,00
2. save as VSElevated.reg
3. go to where you saved the .reg file and double click, yes to everything and ok.
4. This is how your Registry should look like afterwards:
The reason i think is the %1 is missing in your launch command. This should solve it.

How do I add a default Run As Administrator when I open a sln file from the command prompt or Windows 7/8 Jump List menu?

I have been researching around the web trying to figure out how to add Run As Administrator as the default menu item for a Visual Studio solution when you:
right-click the solution in Windows Explorer
right-click on a pinned application, such as Visual Studio 2013, to bring up the Jump List and then select the solution
The instructions that I have found so far:
http://www.howtogeek.com/howto/windows-vista/add-run-as-administrator-to-any-file-type-in-windows-vista/
show how to easily add the Run As Administrator menu item to an existing file type. You just have to find the right registry keys for the Visual Studio version that you're working with. For example, Visual Studio 2013's registry key for its solution file type is:
[HKEY_CLASSES_ROOT\VisualStudio.sln.12.0]
Then you just copy the Open command under the shell key, then paste it in as a new key whose name is runas.
After that change, when you right-click on the solution in Windows Explorer, Run As Administrator is in the list of commands. But it is not the default.
To open the solution as Administrator from the Jump List menu, when you right-click on Visual Studio as a pinned icon, you have to right-click on the solution file in the Jump List, then select Run As Administrator.
But I couldn't find anywhere about how to make the Run As Administrator the default command in this menu.
So how do you do that?
Easiest way is doing this:
Right click visual studio and open file location.
(If it's the shortcut, right click then click properties. On the bottom click on "Open File Location")
This should lead you to devenv.exe.
Right click this and select troubleshoot compatiblity.
Select troubleshoot program and check off the box for "The program requires additional permissions" and select next.
Now if you open visual studio from where ever, it'll open it as an administrator.
It actually turns out to be one additional registry entry that needs to be set. In the shell key under the file type, change the value of (Default) to be the same name as the command in the registry under the shell folder.
For example, to set Run As Administrator to be the default, you would set the value of (Default) in HKEY_CLASSES_ROOT\VisualStudio.sln.12.0\shell to be runas.
When exported, this setting looks like this:
[HKEY_CLASSES_ROOT\VisualStudio.sln.12.0\shell]
#="runas"
Now when you right-click the solution in Windows Explorer, or when you right-click the solution after right-clicking to bring up the Jump List on the Visual Studio 2013 pinned icon, Run As Administrator is the default command instead of Open.
So you can confidently open the solution itself from Windows Explorer or the Jump List menu and watch as Visual Studio opens as Administrator.
Updating answer for Visual Studio 2015 (under covers version "14.0"). Tested on on Windows 10 Pro v1703 Creators Update. Picture below illustrates the first registry change. Second change goes one better - no need to right-click the jump list item at all.
Windows Registry Editor Version 5.00
;To add "Run As Administrator" to Visual Studio 2015 Taskbar Jump List solution right-clicks
[HKEY_CLASSES_ROOT\VisualStudio.sln.14.0\shell\RunAs]
[HKEY_CLASSES_ROOT\VisualStudio.sln.14.0\shell\RunAs\command]
#="\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\devenv.exe\" \"%1\""
;To make Jump List solutions open As Administrator by default
[HKEY_CLASSES_ROOT\VisualStudio.sln.14.0\shell]
#="runas"

Visual Studio 2012 MSVSMON.EXE does not work

I'm really tired of this error.
Most of the time, when I want to debug the program , I'm faced with this message.
Microsoft to offer solutions, but it is quite confusing:
1.
Make sure the Visual Studio Remote Debugging Monitor is installed and running on the remote machine.
2.
Make sure the Remote Server Name is correct in the Name box in the Project Properties dialog box.
3.
Verify that the remote machine is accessible on the network.
please someone help and guide me because all of my projects have been suspended and i need visual studio debugging.
meanwhile, when i dc from internet, visual studio will work.
Windows 7 x64, VS 2012, VB.NET
I fixed it like this:-
Create a shortcut on your desktop to "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Remote Debugger\x64\msvsmon.exe".
Right-click shortcut and select "Properties" from the dropdown menu.
Select the "Compatibity" tab
Tick "Run this program as administrator"
Click OK
Create a shortcut on your desktop to "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe".
Right-click shortcut and select "Properties" from the dropdown menu.
Select the "Compatibity" tab
Tick "Run this program as administrator"
Click OK
To start VS2012:-
1) Double-click the msvsmon shortcut icon (that you created above, to launch msvsmon)
2) Double-click the "Visual Studio 2012 Professional" shortcut icon (that you created above, to launch VS2012)
3) In VS2012, ensure standard toolbar is visible.
4) In VS2012, ensure "Solution Platforms" dropdown (on standard toolbar) is visible and set to "x86".
and ... wowee ... debug works !
I had the same problem. I fixed changing in properties/compile/target platform to x86 instead of Any CPU. It was the problem in my case. Hope it helps.
I got this error when starting VS2012 as a normal user. When starting as an administrator it opened up a UserControl TestContainer window instead.
What have happend was that the startup project was changed. I changed back to my ordinary startup project by right-click on it and choose "Set as StartUp Project".
I have started vs 2012 as administrator and it is fixed

visual studio 2010: the application data folder for visual studio cannot be created

I just installed visual studio 2010 on my win7 32 bit computer and i get the following message when I start it:
"the application data folder for visual studio cannot be created"
I had this same version of visual studio on my xp sp3 computer and it worked fine.
I googled for various solutions but nothing worked.
I tried to run:
"%programfiles%\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /setup
and to edit the [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders] AppData entry (but it was already okay). I tried to run as administrator.
Is there any other fix to this problem?
ps: after I installed visaul studio there was no desktop shortcut, the start menu folder was empty until I added premmisions for myself (I'm already admin...) and after that the start menu shortcit had no icon and didn't work so I had to run visual studion from the installation folders devenv.exe.
It sounds like Visual Studio is having problems creating the following folder
%USERPROFILE%\AppData\Local\Microsoft\VisualStudio
Or one of the sub folders it creates for storing data (10.0 for example). I would first try accessing that directory location or it's parent and make sure that your account has the proper permissions to create folders in that location.
Go to your AppData folder (c:\Users\\AppData)
Right click, Security tab; click Advanced button.
If your username is not in the "Group or user names" list, click the Edit button and add it.
Give yourself full control.
Make sure your select "apply to all subfolders".
Restart Visual Studio.
Mine was the same issue but for VS 2013. On your C:\Users\xxx\AppData\Local, find my Microsoft folder and Right-Click, properties, uncheck ReadOnly and make sure your name is under Security with full access. Then right-click on installer and try repair (or fresh install).
I tried to right click and run VS2010 as administrator and it worked :D
I solved my problem by changing permissions to the roaming folder, not local.
%USERPROFILE%\AppData\Roaming\Microsoft\
I figured it out after reading this:
http://tutewall.com/application-data-folder-for-visual-studio-could-not-be-created/
With Windows 10 x64, I solved this probem running the IDE as Administrator (right clic > Run as administrator)
if you have more than 1 vs versions installed, then simply change open with (or select vs 2015 or any stable version from upper open option) visual studio 2015
Then the solution is prepared and displayed.
Thanks.

Resources