Nah. When you click start, it starts whichever project is set to Start, which in my case was some WinForms old test project of no use. You can't set a library to start.

I created a mini test project which did some CPU and IO work. If I start the profiler it starts and waits, and when I run a unit test method it reports nothing useful, just a [System Code] execution. In release mode the profile just starts and stops while I've done nothing. All I can get is:

image.png

I'll wager that Chat GPT is smarter than me, so there's probably a way of profiling a unit test, but my feeble biased human brain can't find it yet. If it is possible and I can't find it, then the VS team needs to have a chat to Chat GPT and ask it how to improve discoverability.

Greg K
 
In the Performance Profiler, several profiling options are available, such as CPU Usage, Memory Usage, etc. For CPU performance, ensure CPU Usage is checked.
Click Start.
Run the Specific Test:

The profiler will start, and Visual Studio will switch to a profiling mode. Now, navigate to the Test Explorer.
Find the [TestMethod] you want to profile.
Right-click on the test method and select Run. If your test project contains multiple tests and you only want to profile a specific one, make sure only that test is set to run.