Why F5 does not start a unit test in VS2008? - visual-studio

I have a solution with several projects and all of them are unit test projects. While I can start some tests selecting the project as the startup project and pressing F5 there are other projects that when selected as startup and pressed F5 says that a project with an ouput type of class library can not started.
I've compared the projects and all looks the same with the same project properties. Any hint about this?
Thanks in advance mates.

Check the properties of your projects that start when you press F5. I'm guessing that some of your projects have have a start action specified in the debug tab (specifically Start external program) that runs something like the NUnit test runner and passes your class library to it.

The problem was that the project was created to be tested with NUnit and thus was created as a "New class library" instead of a "New test project". This must be writing something at the project file that specifies how to behave when pressing F5.

Related

IntelliJ IDEA: Open build tool window

I'm using IntelliJ IDEA 2022.3 and Maven for building my project. I've set "Delegate IDE build/run actions to Maven".
Is it possible to automatically open a Build tool window when I build the project or a module?
Something like "open run/debug tool window when started" option on application run configurations.
I went with the solution floating-cat provided:
I think the IDEA doesn't have this feature. But you could try to record a macro which shows the Build tool window first and build this project.

Visual Studio stopped rebuilding dependent projects

Suddenly, Visual Studio 2010 has stopped behaving as it used to:
I have a solution containing several projects: a Class Library project, an Application project and a Test project.
The Application project is set as default startup project.
Now if I change anything in the Class Library and press F5, Visual Studio does not rebuild the Class Library anymore, so that it runs outdated code.
Same behaviour with the Test project.
What am I doing wrong? I am pretty sure this type of behaviour is new, but I do not know what I have changed.
In the solution explorer, right click on the solution name and go to "Configuration Manager.."
You will see the active solution configuration. Select which project to build or not by turning the checkbox on or off. Hope that solves your problem.

Run multiple instances with one click in Visual Studio

I wonder if I can run multiple instances (right now two instances) of my application in debug mode by doing a simple click or set a key for that...
Not many people seem to know this, but this is perfectly possible, though I admit it's not very obvious.
Here's what you do:
suppose your current project is A, and it's output is c:\bin\my.exe
add an empty project to the solution for A, call it 'Dummy'
under Dummy's Project Properties->Debugging set the Command to point c:\bin\my.exe
under Solution Properties->Configuration Manager, uncheck all builds of the Dummy project so VS won't try to build it (building an empty project fails)
under Solution Properties->Startup Project, select Multiple Startup Projects and set the Action for both A and Dummy to Start
now hit F5 and your exe will be launched twice, each under a seperate debugging instance. (as you will be able to see in the Debug->View->Processes window)
You can use "Multiple Startup Projects" feature, but avoid creating dummy projects by hand: just add your debuggee executable into the solution directly:
Solution > Add existing project > Path to .exe
If you neeed several instances, Visual Studio won't allow you to add the same executable twice, but adding a symlink to it with another name works as expected.
MSDN: How to: Debug an Executable Not Part of a Visual Studio Solution
Is Visual Studio 2013 this is even easier!
Project-> Properties -> Debug -> check "Start external program" and click the ... button, navigate to your .exe of the other program.
Then Make sure in your Solution -> Properties -> MultipleStartup Projects that it's checked.
You can run two instances of your application from where it is built; example: d:\test\bin\debug\app.exe and attach both instances to the Visual Studio 2010 debugger.

Running two projects at once in Visual Studio

I created a solution in Visual C# 2010 Express that contains two projects: one is the client, the other is the server. I would like to debug both at the same time, but I can only seem to run one of the projects during debugging.
Is there a way to run both at once?
Go to Solution properties → Common Properties → Startup Project and select Multiple startup projects.
Max has the best solution for when you always want to start both projects, but you can also right click a project and choose menu Debug → Start New Instance.
This is an option when you only occasionally need to start the second project or when you need to delay the start of the second project (maybe the server needs to get up and running before the client tries to connect, or something).

team system unit testing and configuration

In vs team system 2008 unit test, how can i load an application configuration file in the test itself?
i have an app.config in the test project, referenced System.Configuration but when running the test, it doesn't see the app.config
Have a pre-build batch event that copies it across from your app directory.
You can add this by right clicking on your test project (or the app) and clicking Properties. When the page opens select "Build Events" from the menu and enter your command e.g:
xcopy ../app.config ../../Test/bin/app.config
Or maintain a copy yourself.

Resources