Cannot run "Selected Tests" Visual Studio 2015 - visual-studio

In Visual Studio 2015 I have a bunch of test projects (xunit/nunit). Usually I can just select to run one of them. But that does not seem to be possible anymore. In VS the run Selected Tests is greyed out:
And I can only choose to run all tests. What am I missing?

Open Test Explorer - (You can do this from the Test/Windows menu)
Select one or more tests in Test Explorer.
The Run/Selected Tests menu option will no longer be greyed out.

Related

Can not build C# project with Visual Studio 2022

I don't know what happens with my Visual Studio 2022. When I create a C++ console project, I can build the project. However, when I do the same thing for C# project, I can not build the project. I look like in the picture. Any help is truly appreciated.
I tried everything I can but it didn't work.
That sounds like a bug. When a new project is created, it should appear in Solution Explorer. However your solution has no projects, and the source file appears in "Miscellaneous Files" (meaning it's not part of a project, and therefore VS won't know how to build it).
Please use the Visual Studio Installer to run a repair on your VS installation. If that doesn't help, use Help | Send feedback | Report a problem and include a recording of the steps you're taking to create a new project. If you link the feedback ticket here, I can make sure it gets looked at by the right people. Thanks.
You need to create a new Console App for creating and running C#
projects
Press F5, choose Debug > Start with debugging from the Visual Studio
menu, or select the green Start arrow and project name on the Visual
Studio toolbar. Or, to run without debugging, press Ctrl+F5 or choose
Debug > Start without debugging from the Visual Studio menu.

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.

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

Run specific unit test in Visual Studio from the code window

I know I can click items in the test-explorers and run individual tests from there, but I would like to be able to right click or use a shortcut key to run the test of the method that has the current focus in the editor.
There doesn't appear to be a "run test" item available.
The best (but non-free) option is ReSharper:
Alternatives are:
NUnit Test Adapter (free)
TestDriven.Net (non-free)
NUnitForVS (free; Visual Studio 2008–2010 only)

Visual Studio 2012 runs app with existing errors

my Visual Studio 2012 Ultimate compiles even though there's an error. It takes the old .exe then. I remember, that there's a popup that asks - "Do you want that we take the old .exe" - or something similar and I probably clicked yes there by mistake. However, I can't find that settings and therefor can't deactivate that.
Does anyone know where I can do that?
Tools > Options > Projects and Solutions > Build and Run:
"On Run, when build or deployment errors occur:"
-> "Prompt to launch"
edit: You may need to click "Show all settings" for the "Projects and Solutions" category to be visible.

Resources