Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Move HTML report generator to a razor library #742

Merged
merged 4 commits into from
Dec 18, 2018

Conversation

twsouthwick
Copy link
Member

This change replaces RazorEngine with a ASP.NET Core Razor library. Since the MVC libraries only support .NET Standard 2.0, it will not run on .NET 4.6.1, so now HTML reports in offline mode are only supported on core.

Fixes #649

@twsouthwick twsouthwick requested a review from chlowell December 18, 2018 19:21
@twsouthwick
Copy link
Member Author

twsouthwick commented Dec 18, 2018

A comment about this change: it does not attempt to make the report generator more in line with current Razor best practices (ie tag helpers, async partials, etc). It is solely to get the framework in place to remove RazorEngine.

An issue here is that the new APIs use async, while our IReportWriter is not async. I'll look to see what it'll take to change it, but for now we'll have an ugly .GetAwaiter().GetResult() in there :(

@conniey
Copy link
Member

conniey commented Dec 18, 2018

@twsouthwick When you mean that it won't work on .NET 4.6.1, is that for systems without .NET Core 2.0 SDK installed?
https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support

@twsouthwick
Copy link
Member Author

Weird - it was telling me I couldn't use it on .NET 4.6.1... let me try again

services.AddSingleton<DiagnosticSource>(new DiagnosticListener("Microsoft.AspNetCore"));
services.AddLogging();
services.AddMvc();
services.AddMvc();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant AddMvc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Member

@conniey conniey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@@ -51,7 +55,7 @@
}
@foreach (var invalidAssembly in reportingResult.GetAssembliesWithError())
{
var fileName = Path.GetFileName(invalidAssembly);
var fileName = System.IO.Path.GetFileName(invalidAssembly);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a collision when we had the @using System.IO in there?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup - there's a property in razor apparently that is Path

@twsouthwick
Copy link
Member Author

So the HTML writer is now available on .NET 4.6.1 builds as well as core - not sure why I was getting errors... probably a point in time thing with changing the projects around.

I also updated things to be non-async in #743 and merged those changes here to remove the pesky .GetAwaiter().GetResut()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants