Whenever I execute the ExtentReport.flush() method I get en exception regarding references.
I have downloaded the package using NuGet and I don't have issues compiling the code. In another test project, it works fine. I copied the test code to the current project and nothing works.
RazorEngine.Templating.TemplateCompilationException HResult=0x80131500 Message=Errors while compiling a Template.
Please try the following to solve the situation:
- If the problem is about missing/invalid references or multiple defines either try to load the missing references manually (in the compiling appdomain!) or Specify your references manually by providing your own IReferenceResolver implementation. See https://antaris.github.io/RazorEngine/ReferenceResolver.html for details. Currently all references have to be available as files!
- If you get 'class' does not contain a definition for 'member': try another modelType (for example 'null' to make the model dynamic). NOTE: You CANNOT use typeof(dynamic) to make the model dynamic! Or try to use static instead of anonymous/dynamic types. More details about the error:
- error: (15, 11) The type or namespace name 'AventStack' could not be found (are you missing a using directive or an assembly reference?)
- error: (16, 11) The type or namespace name 'AventStack' could not be found (are you missing a using directive or an assembly reference?)
- error: (17, 11) The type or namespace name 'RazorEngine' could not be found (are you missing a using directive or an assembly reference?)
- error: (18, 11) The type or namespace name 'RazorEngine' could not be found (are you missing a using directive or an assembly reference?)
- error: (21, 65) The type or namespace name 'RazorEngine' could not be found (are you missing a using directive or an assembly reference?)
- error: (21, 101) The type or namespace name 'AventStack' could not be found (are you missing a using directive or an assembly
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
using System.Configuration;
using System.IO;
using System.Diagnostics;
using AutomationClientProduct;
using AutomationReporter;
using AventStack.ExtentReports;
using AventStack.ExtentReports.Reporter;
static class Program
{
[STAThread]
static void Main(string[] args)
{
ExtentHtmlReporter reporter = new
ExtentHtmlReporter(@"C:\TestResults\result.html");
ExtentReports reports = new ExtentReports();
reports.AttachReporter(reporter);
var logger = reports.CreateTest("New test");
logger.Pass("Success");
logger.Info("Succeeded test");
logger = reports.CreateTest("Second Test");
logger.Fail("test failed");
reports.Flush();
}
User contributions licensed under CC BY-SA 3.0