MiniProfiler for .NET Documentation Go to the repo

.NET (Console Applications)

If you’d rather learn by example, sample apps are available. The .NET Console sample is here, with the important bits in Program.cs.

Installation and Configuration

  • Install the NuGet Package: MiniProfiler
    • Either use the NuGet UI to install MiniProfiler (which has all needed dependencies)
    • Or use the Package Manager Console:
Install-Package MiniProfiler -IncludePrerelease
  • Edit your Program.cs to configure MiniProfiler and start profiling:
public static void Main()
    // Default configuration usually works for most, but overrde, you can call:
    // MiniProfiler.Configure(new MiniProfilerOptions { ... });

    var profiler = MiniProfiler.StartNew("My Pofiler Name");
    using (profiler.Step("Main Work"))
        // Do some work...

Note that we’re using DefaultProfilerProvider here because we’re not in a web context, e.g. we don’t want pofiles accessed via HttpContext.Items in a console application.