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

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/)

Related

How do I enable the debugger in Visual Studio 2019?

The debug type field is greyed out as are the build buttons. I opened a folder in visual studio 2019 with my project and source code files. I have not installed any extensions yet either. I read somewhere to select a startup item but none of the items in the solution explorer are valid except for Gradebook.dll in the debug folder although that doesn't seem to do anything.
Did you try to click the run button or press F5.
If so it should prompt you to select CPU. Then, run it again and it should work.
If that doesn't work try going into "Program.cs" in the Solution Explorer and make sure the Application.Run line is there.

How to Fix Unrecognized Guid format in Visual Studio 2015

I'm getting an "Unrecognized Guid format" error when I try to open my project in Visual Studio 2015 on a Windows 10 machine (upgraded from Windows 7).
This did not always occur for me. I originally made VS studio open as administrator (because my project needed it at the time) by following the steps in the anwser here: Can you force Visual Studio to always run as an Administrator in Windows 8?
I then decided I wanted to switch back to not having it open as admin. To try and switch back I again ran the compatibility troubleshooter, this time I selected "try recommended settings". After doing this I am now getting the Guid error every time I open my project and I can no longer run it. I even get it if I open VS as admin like I did before.
I even tried uninstalling Visual Studio and reinstalling it but that did not work either.
I am guessing you used to run Visual Studio as Administrator. This did it for me. The answer is to delete the compatibility entry in the registry.
Type Windows+R on the keyboard to open the Run dialog
Type regedit and press enter
Browse to HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
Delete the Visual Studio entry
I fixed this on Windows 10 by using the Troubleshoot compatibility tool. It has to do with an extra checkbox being enabled.
Navigate to devenv.exe by right clicking Visual Studio from start, click
properties, and select "Open File Location...".
Right click on devenv.exe and select "Troubleshoot Compatibility".
Click "Troubleshoot Program"
Uncheck "it worked with older versions of windows"
Click "Next"
Click "Test the program"
Confirm everything opens correctly
Click "Next"
Click "Yes, save these settings for this program"

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

Open the start page in Visual Studio after closing a project?

When you start Visual Studio you get a start page with all the latest projects in a list.
But when you've opened and closed a project, how do you open that start page again?
(Without restarting VS)
Visual Studio 2010-2015
There's a menu item View -> Start Page
Additionally you can choose to keep the start page open when loading a project. There's a check box below the projects list for that.
(Tested in VS2010, VS2012, VS2013, VS2015)
In current versions, you can also use the Quick Launch (Ctrl+Q) to search for the command
(Just type "Start Page" in Quick Launch)
Visual Studio 2017
There's a menu item File -> Start Page
You can configure the behavior of the IDE on startup via Tools -> Options -> Environment -> Startup.
In Visual Studio 2017, the start page will open automatically when the solution is closed. As far as I know, this cannot be changed directly in the IDE but there's an extension that adds that feature. See this question on SO and this VSIX-Extension (but this will disable the start page completely - if you try to open it manually, it will be immediately closed automatically)
You also have the Start Page icon in the toolbar :
In VS2013 by default I do not see the "Start Page" command in the View menu but adding it was simple. The icon also looks different in VS2013.
Right click on the toolbar and choose Customize... at the bottom then go to Commands
Switch to Toolbar/Standard and then click the Add Command button an locate the View group on the left
Finally locate the Start Page item and click OK.
In VS 2017 the new location for viewing the start page
is under the 'file' menu. as appears in this link:
https://developercommunity.visualstudio.com/content/problem/4603/view-start-page-menu-item-is-missing.html
In VS 2017 it's in File->Start Page.
By now there is an extension exactly for that purpose:
https://visualstudiogallery.msdn.microsoft.com/e64380ab-e3aa-4ac7-aa11-95719c5c91e9
I tried it an it works like a charme in VS 2015 :)
To get start page in visual studio 2017 Go to File -> Start Page
In case of Visual Studio 2019, go to File->Start Window.
It used to be automatic in VS2008 - Anything you had open outside of any solution/project (including the start page) would close when you opened a project/solution, then when closed that product/solution it went back to what was open before. That is how it should work, they broke it in VS2010. So all the prior VS users searching for the answer - there is none - technology continues to regress.
You can create custom shortcuts in VS under Tools > options > Environment > Keyboard.
makes it super easy to reopen the start page.
Here is my setup if you get confused
custom start page shortcut
In VS 2022 it's in Tools->Option->Environment->General->On Startup
Screenshot

Resources