Here is my code:
public static ExtentReports getInstance()
{
if (extent == null)
{
string reportFile = DateTime.Now.ToString().Replace("-", "_").Replace(":", "_").Replace(" ", "_") + ".html";
htmlReporter = new ExtentHtmlReporter(@"C:\desktop\Extent_Reports\" + reportFile);
extent = new ExtentReports();
extent.AttachReporter(htmlReporter);
extent.AddSystemInfo("OS", "Windows");
extent.AddSystemInfo("Environment", "QA");
string filePath=Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory);
filePath=Directory.GetParent(Directory.GetParent(filePath).FullName).FullName;
htmlReporter.LoadConfig(filePath + "\\extent-config.xml");
}
return extent;
}