Tests magically disappeared from Test Explorer pane in Visual Studio 2013 - visual-studio-2013

I have created a unit test project in VS2013, and I'm using it to create a test suite for my SQL Server 2012 database.
I have created 4 test classes so far and everything worked fine. When I created the 5th - magic! All tests disappear from the test explorer window.
I tried rebuilding the project - didn't work. Rebuilt the database project too; didn't work. Created a new unit testing project with a single unit test inside it - doesn't work.
Has this happened to anyone? Does anyone know what to do? Please help!

Visual Studio Test Explorer has icons that control what tests are shown, make sure what you want to see is selected. For example, if you unselect the green checkbox, tests will disappear as they pass.

Are you using nUnit? I've just had a similar situation moving to a new pc, causing all existing tests to disappear.
Go to Tools -> Extensions and updates -> Select Online on the left -> enter in the search box top right 'nunit test adapter' and install it.
One rebuild later and the tests appeared again.

Late to the party, but make sure you have the chemical bottle icon selected. If there's a failure it may have defaulted to failures (the X) icon selected in the test explorer window. Gets me every time.

I just had the exact same thing happen to be. Build, Rebuild, Clean Build, the Test Explorer couldn't list for me my unit tests!
This came after I changed the unit test project's platform target from "any CPU" to x64. I switched it back to "any CPU", built, and they appeared again. How frustrating.

I had a similar problem, the test appeared again after deleting the hidden .vs folder in the project build folder and then restarting visual studio.

I just had this very same problem and for me the solution was to go to Tools -> Extensions and updates, uninstall NuGet package installer for 2013 and re-install it.

Related

VS 2015 Test Explorer is empty

I'm on update 3 with VS2015 and suddenly Test Explorer (for MSTest) doesn't show anything, it's just empty.
I don't have any extensions installed that relate to unit testing, no NUnit stuff, no Resharper etc. Obviously, solution has been compiled. The same for all solutions with unit tests, they all used to show tests in test explorer but suddenly they all are empty.
What does not work:
Rebooting
Restarting VS 2015
Devenv.exe /ResetSettings
Running a test (by right-clicking on test code)
Setting Processor Architecture to X64 in Test Settings
Starting VS in admin mode
Deleting contents of %LocalAppData%\Micr‌​osoft\VisualStudio\12‌.0\ComponentModelCach‌​e
Anyone have a fix?
pom
Please see issue and fix here: https://connect.microsoft.com/VisualStudio/Feedback/Details/2970831. Let us know if this fixed it in your case.

How to figure out why ReSharper is not rebuilding unit test project before running?

Recently I am having an annoying problem. When I go to Unit Test Sessions window and run some tests, ReSharper seems to completely ignore any changes in my code(even in the code of the test itself!) and does not rebuild anything. Because of that I have to rebuild everything manually. I think that problem is too generic to post on bug-tracker so I would like to find at least any additional information. For MsBuild I can always enable diagnostic logging and track all its decisions during build. How can I find what is the problem with ReSharper?
Versions:
Visual Studio 2015 Pro Update 2; ReSharper Ultimate 2016.1.2.
Have you installed the Rider EAP by any chance? There is a bug in the latest EAP (EAP7) that sets the build action before running tests to "Never", and since the global settings file is shared between Rider and ReSharper, this also causes ReSharper to not build tests before running. The fix is simple - just change the value in the drop down in the unit test runner window. See the bug report for more details.
One thing I'm not sure on is if this is a recurring issue - i.e. the value gets reset to "Never" every time Rider opens the unit testing window. This is an unfortunate bug, and will definitely be fixed for EAP8.

VS2013 Build "Does not support previewing"

Every time I try to build my solution in VS2013, nothing builds, no errors - But in the status bar it says: "This item does not support previewing"
I googled around a bit but have come up empty.
But if I right click on each project and select build it works fine.
Any ideas?
Perhaps this message is totally unrelated... Post hoc ergo propter hoc
Steps to reproduce on my machine:
Right Click any project in solution: select build
Status bar displays Build successful
Right click solution select build
Status bar displays : "This item does not support previewing"
Perhaps it isnt related, but it sure does appear to be.
I was able to fix this... Somehow nothing was selected to build in the solution configuration. I right clicked on the solution, went to properties and then selected COnfiguration Properties and clicked the Build box for all the projects...
I have no idea how they became unchecked, only thing I can think of is a co-worker was trolling me.....
I've had this problem (i.e. debug not starting, and no error message) with Visual Studio 2015 in the following two cases:
after loading a solution that had previously been built with Visual Studio 2010
and also after using the "save as" function in Visual Studio 2015 to update a solution that had been started with Visual Studio 2010 (using Save as updates the solution file and sets the active Visual Studio version to 14 - i.e. VS 2015).
In both cases, deleting the bin and obj directories under the startup project fixed the problem. It's also worth closing visual studio and making sure that there are no {yourprojectname}.vshost.exe processes still running - if there are then kill them before running visual studio again. On that note, if you have multiple versions of visual studio on your machine, you should also check that you don't have the same solution open in the other version of visual studio at the same time (I've done that one myself).
One of the comments here suggests disabling the "enable visual studio hosted process" option. Don't do that if you can at all avoid it: you'll lose lots of debugging functionality (particularly in the area of being able to edit code while your solution is running).
Hope that helps someone out there.
Solution for VS2015
"this item does not support previewing" vs2015 (Visual Studio 2015/2016)
Step 1. Go to Control Panel -> Programs and Features
Step 2. Uninstall all: Windows Software Development Kit - Windows 10.0.10586.15 (maybe you have diff ver)
Step 3. Download new latest Windows Software Development Kit
https://go.microsoft.com/fwlink/p/?LinkId=619296
Install & Create new project, Done!
Dclick on MainPage.xaml and you will see Loading designer...
1: Add below lines in App.conf
<specFlow>
<unitTestProvider name="MSTest"></unitTestProvider>
</specFlow>
2: add a reference to Microsoft.VisualStudio.QualityTestTools.UnitTestFramework.dll
right click on your project and select: Add Reference
3: add using Microsoft.VisualStudio.TestTools.UnitTesting; in Step Defination
4: goto feature file and run it. This is what solve my problem on vs2013
I faced same issue with .aspx file. I just right click on the .aspx file and select open with (HTML Editor). You can choose any form the list.
I have come across the same issue for me, I have opened a project in VS 2010 and then when I open the same in VS 2015 then his error has occurred.
Solution:
By Closing the VS2010 project solution fixed the issue.

How to set the startup project in Expression Blend 2

Does any one know how to set the startup project in Expression Blend 2? I have a solution which builds 2 executable files. I've set the Startup Project to the one I want to debug in Visual Studio and when I run it from VS that project launches no problem. However if I open the solution in Blend and press F5 to run it the other project always launches.
There doesn't seem to be a way of setting the Startup project in Blend, and it does seem to respect the setting in Visual Studio. Or am I missing something?
Why does Blend always launch the other project and is there anyway I can change this?
Thanks
Kaneda
In the project explorer (Blend), right-click the project name within the solution and make sure 'Startup Project' is checked.
I've only got Blend 3 RC to check on at the moment but I'm pretty sure this was also in Blend 2.
Ok, I see. Turns out that the feature was added with SP1 and I didn't have that installed. Installed that, now my solution launches properly

A project with output type of class library cannot be started directly - with a startup exe

Firstly I'm completely aware of this message and why it happens normally. It's not that I'm just trying to run a dll (like this question).
I have a project that compiles to a dll but has a startup program specified in the project properties. Most of the time I'm able to right-click on the project and select Debug > Start new instance, and it will run the program and let me debug my dll. However, occasionally I get this message (A project with output type of class library cannot be started directly) as if I haven't got a startup program. The first few times I thought it was just me accidentally clicking on the wrong project but I'm certain this isn't the case given that it's happened so many times and I've been careful to watch it.
When this message appears I'm able to try it again and it always works on the second or third attempt.
A colleague using the same Solution never has this problem :-/
Anyone else had this problem or know how to solve it?
I'm using Visual Studio 2005 Pro Version 8.0.50727.762 (SP.050727-7600)
Edit: Also happens with Visual Studio 2010
Another colleague suggested it's because after clicking Debug > Start new instance, while I'm waiting for it to start up, I click on a different project. I don't do it for any reason, just randomly selecting things as I wait for the project to start up. Maybe Visual Studio looks at the selected project sometime after I clicked the menu, gets confused, and shows the error message?
Anyone able to confirm this matches their experience?
Typically problems in VS are caused by:
Add-ins: Run VS without and see if the problems is solved
Corrupted files in your solution: Delete / rename all files created by Visual Studio which are not part of your project, i.e. all .suo, .ncb files and a like.
I had this problem with projects that were created as "Windows Control Library" that somehow forget their status. Unloading and reloading the project usually did the trick.
If it was created as a "Class Library" then to make it a "Windows Control Library" I manually add the following to the .csproj file. It was the only difference I could see between a class library and windows control library project.
BTW - starting a Windows Control Library starts the User Control Test Container - allows you to test any user control in the library. Very cool.
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
add that inside of an <itemgroup> element.
If you plan to use/create/add extra dll's or just have more than one project in your solution, you may get this kind of problem, especially if you forgot a simple rule:
1. In your "Solution Explorer" window. Right click and chose "Set StartUp Projects..."
2. Under "Start Up Project" select and change "Single startup project" to your working entity.
no just make a start up project
Going to resurrect this thread, I have just been experiencing similar issues, when right clicking a project and start new instance..
So instead of right clicking the project and selecting start new instance, I right clicked and clicked set as startup project.
Low and behold a class library project was set to bold, certainly not the one I was right clicking.
I tried selecting a different executable project and setting that as the startup project. Same class library was highlighted as the start up project.
Realised that the current open file was from that project, possibly all the open files were from that project...
closed all open files and tried again.... Problem solved, behaviour as expected for both set as start up project and start new instance options...
Definitely a bug, hope this helps others..
Microsoft Visual Studio 2010 Version 10.0.40219.1 SP1Rel
Microsoft .NET Framework Version 4.0.30319 SP1Rel
This sounds like a transient Visual Studio problem. Reinstallation or upgrade may solve your problem.
I've seen this as well, and it seems like a bug in VS. It happens after you right-click/build a class library (that requires rebuilding), and then right-click/debug > start new instance.
edit- It's still very intermittent, I can't seem reproduce it reliably
I've found that I've had the Startup Project on the Solution set to Current selection, then at some point, I've unloaded a project, and the solution has reverted to Single startup project on a project that happens to be a class library.

Resources