Following functions from the VisualTimeSpentExt.Reports class are available:
// Returns activity summary grouped by solution/project/window and sorted by time spent. static UserActivitySummary UserActivity(System.DateTime from, System.DateTime to)
To run your application that references vtsext.dll, copy to the application directory following files from "C:\Program Files (x86)\Visual Time Spent": sqlceca40.dll, sqlcecompact40.dll, sqlceer40EN.dll, sqlceme40.dll, sqlceqp40.dll, sqlcese40.dll, System.Data.SqlServerCe.dll, vtsext.dll.
System.DateTime to = System.DateTime.Now;
System.DateTime from = new System.DateTime(to.Year, to.Month, 1);
VisualTimeSpentExt.UserActivitySummary summary = VisualTimeSpentExt.Reports.UserActivity(from, to);
Console.WriteLine("Time spent in Visual Studio for period {0} - {1}: {2}", from, to, summary.TimeSpent);
foreach (VisualTimeSpentExt.SolutionActivitySummary solution in summary.Solutions)
{
string name = solution.Info != null ? solution.Info.Name : "[No solution]";
string path = solution.Info != null ? solution.Info.Path : "";
Console.WriteLine(" Solution {0}: {1} ({2})", name, solution.TimeSpent, path);
foreach (VisualTimeSpentExt.ProjectActivitySummary project in solution.Projects)
{
string projectName = project.Info != null ? project.Info.Name : "[No project]";
string projectPath = project.Info != null ? project.Info.Path : "";
Console.WriteLine(" Project {0}: {1} ({2})", projectName, project.TimeSpent, projectPath);
foreach (VisualTimeSpentExt.WindowActivitySummary window in project.Windows)
{
string title = window.Title != null ? window.Title : "[No window]";
Console.WriteLine(" Window {0}: {1}", title, window.TimeSpent);
}
}
}
Copyright 2008 - 2025 Vlasov Studio (Best in class Visual Studio extensions and tools)