Closed pascalberger closed 4 years ago
As RazorEngine doesn't support netstandard 2.0 RazorLight or gazorator might be an option
There is also the RazorEngine.NetCore, which is a fork of RazorEngine itself.
Although the repository of the project is currently looking for new maintainers, I think it could be a good alternative until the codebase have been updated to use an alternative engine. (Mainly I think it is a good idea, just to be able to provide a .NET Core compatible project).
@AdmiringWorm I tried to replace RazoreEngine
with RazorEngine.NetCore
, but unfortunately it doesn't seem to be a drop in replacement and there are compilation errors with the current templates. If you wan't to give it a try I would happily accept a PR for it.
RazorLight
also seems to be unmaintained nowadays, with no final 2.0 version. And Gazorator requires at least https://github.com/mholo65/gazorator/issues/4 to be implemented first.
I see, I thought it would perhaps be a drop-in replacement. (Never tried anyone of them, nor programmed directly using RazorEngine either unfortunately).
But I'll see if I can't get it to work (unfortunately got other priorities right now, so it probably will take some time until I do).
I've been trying to figure out how to do this for a while now, and I'm sorry to say that I can not figure out how to make it work.
I'm including a patch of the changes I made, in case someone else is able to continue the work (and they don't have to start from scratch).
@pascalberger it looks like RazorLight has active development. I would be happy to pick this up and run with it since I want to use Cake.Recipe on .NET Core.
@phillipsj What bothers me about Razor Light is that while there seem to be commits to the repo, their last (pre)release was over one and a half release ago, the last proper release over two years.
@pascalberger Thankfully, seems to be some betas now coming through, so Razor Light may still be viable. https://github.com/toddams/RazorLight/releases Was the intention to shift to the new dotnet project files? I've got a build working for them. Not sure there's much point in a PR just for that - guessing you're keen to have this multi-targeted for netcoreapp2.0 and net461 ? If so I can have a go based on @phillipsj code - tho he seems to have removed it.
@gavinjonesnz I'm happy to accept a PR for changing to the new project format. Would even prefer to have it separated from the change of the rendering engine.
If you want to take over #185, and give it a try with latest beta you're welcome to do so. @phillipsj is currently not working on it, but the existing code seems like a good start.
I think (cross fingers) I've got RazorLight mostly working, however there's some oddities with the Expando in RazorLight meaning I think you have to supply a dictionary with all the ViewBag items (otherwise you end up with null object errors because the properties don't exist). Going to test the theory manually, then will have a look on cleaner options. I'll get the tests working, but did you have a larger suite of test cases to try things out on if I do get things going?
@gavinjonesnz There are not really more test cases than in the projects.
What you can try is to rebuild the demo files for the documentation by running /demos/build.ps1. This will create reports for all included templates with most possible options.
@gavinjonesnz Did you had any success on this?
There will be a release with breaking change upcoming soon, and therefore it would be a good time for fundamental changes now :)
@pascalberger yeah, sorry, as usual RL got in the way (and calamity). Will revisit, as I've not done much since Jan. I found some odd perf results with RazorLight, and never really resolved the issues with dynamic/expandos and razor binding the ViewBag. Was going to suggest perhaps a PR to generic-ise the report generator anyway? This is my test-out branch to anyone interested, probably needs a clean up now that other PR merged: https://github.com/gavinjonesnz/Cake.Issues.Reporting.Generic/tree/feature/multitarget-razorlight
@gavinjonesnz No problem. What is your idea regarding making the addin more generic?
Oh, it was more about making a generic interface for the renderer. Made my YAGNI itch, but it was the first thing I played with when trying to run the current renderer and compare it against something new. Just super basic, like this: https://github.com/gavinjonesnz/Cake.Issues.Reporting.Generic/blob/ec82ccbecbb87566b0095f6322f4df7a975f0ef0/src/Cake.Issues.Reporting.Generic/IGenericIssueReportGenerator.cs
Cake.Issues.Reporting.Generic
is already an implementation of an IIssueReportFormat abstraction. Cake.Issues.Reporting.Sarif is another issue report implementation which uses SARIF SDK (instead of Razor like in this case) to generate a SARIF compatible output.
You suggestion would be an abstraction layer about different Razor Engine implementations in this specific report format addin. I'm not sure if it is worth going this route, since evey implementation will also add additional dependencies to the addin.
We also have a look at this on tonights stream from @gep13. 19:00 UTC. Anybody interested is very welcome to join.
Addin should support running on .NET Core.
RazorEngine was replaced with Gazorator as rendering engine which requires the following changes to the templates:
@model
needs to be replaced with@inherits
@Raw
needs to be replaced with@Html.Raw
System.*
namespaces need to be added explicitly through using statements