toddams / RazorLight

Template engine based on Microsoft's Razor parsing engine for .NET Core
Apache License 2.0
1.51k stars 260 forks source link

Could we use this library with .Net 4.6.1 in the future? #147

Closed glikoz closed 6 years ago

glikoz commented 6 years ago

Will this library compatible with .Net Framework 4.6.1 ? It seems Full .Net Supported version was updated a year ago. https://github.com/toddams/RazorLight/tree/full-net-support

Thanks.

toddams commented 6 years ago

Yep, beta2 will bring back.NET Framework support

glikoz commented 6 years ago

Hi,

Do you have a roadmap for it, when will beta2 be completed? Also RC?

Ps:Thanks for good work.

glikoz commented 6 years ago

I can add Beta1 version to my .Net Framework 4.6.1 console application via Nuget. But during test I'm getting weird error image

Am I forcing wrong way?

glikoz commented 6 years ago

We were able to use current beta1 version with .net framework 4.6.1 console application, the problem that i sent is related with dependencycontext, also we patched it, i will send our solution.

RomanDidenko commented 6 years ago

Hi @glikoz, can you please share your solution?

glikoz commented 6 years ago

I will share at the weekend.

glikoz commented 6 years ago

Now I'm sharing :) You can find %100 working .Net 4.6.1 console application that uses RazorLight. It's name is RazorLight.Sandbox.Net. Download my fork and run

https://github.com/glikoz/RazorLight/

glikoz commented 6 years ago

I wrote these if you have a problem after Nuget Restore use same path.

Best wishes.

chrisbuttacavoli commented 6 years ago

I am receiving the exact same error message when I try running RazorLight in a 4.6.1 class library. I am using NUnit to test my templates.

var razor = new RazorLightEngineBuilder()
                    .SetOperatingAssembly(Assembly.GetAssembly(typeof(ITemplateGenerator))) // The assembly with the templates
                    .UseFilesystemProject(this._templatePath)
                    .UseMemoryCachingProvider()
                    .Build();

var templateString = await razor.CompileRenderAsync("Test.cshtml", new { }); // Throws here

When I run this code in my MVC project, there are no issues, doesn't seem like it can resolve the dependencies. Would really like this fixed so I can use automated tests for my application with this code.

The raw exception message:


Result StackTrace:  
at RazorLight.Compilation.DefaultMetadataReferenceManager.Resolve(DependencyContext dependencyContext)
   at RazorLight.Compilation.DefaultMetadataReferenceManager.Resolve(Assembly assembly)
   at RazorLight.Compilation.RoslynCompilationService.EnsureOptions()
   at RazorLight.Compilation.RoslynCompilationService.get_ParseOptions()
   at RazorLight.Compilation.RoslynCompilationService.CreateSyntaxTree(SourceText sourceText)
   at RazorLight.Compilation.RoslynCompilationService.CreateCompilation(String compilationContent, String assemblyName)
   at RazorLight.Compilation.RoslynCompilationService.CompileAndEmit(IGeneratedRazorTemplate razorTemplate)
   at RazorLight.Compilation.RoslynCompilationService.CompileAsync(IGeneratedRazorTemplate razorTemplate)```
adospace commented 6 years ago

@toddams sorry to bother, any eta for beta2: we are really interested in use RazorLight with full framework

Tieantono commented 6 years ago

Yes, I would like to know too, my team are really interested on using RazorLight with .NET Framework.

zagros commented 6 years ago

@toddams - we are getting this same error with .net 4.6.2. Your sandbox uses Dependency Injection 2.0.0.0 but the version 2.0.3 or higher have the error which you seem to have fixed in #159 (669cb741998b6248d7ccfa3f9da2d25acdeaa2f8)

Our project is awaiting your Beta2 release. Can you please provide an ETA?

ghost commented 4 years ago

It seems the project is dead. I tried different options for working with .net Framework - always errors :(

toddams commented 4 years ago

Project is pretty alive. .NET framework is dead

jzabroski commented 4 years ago

@toddams I think the reason people think the project is dead is because the last official non-beta release was a long time ago, and it's confusing as hell when you go to nuget.org and search for Razorlight package.

@dlopatin-Ms Your comments are simply destructive and should be flagged as inappropriate. What is your point in calling something dead? Do you want to take it over?Please open issues for working with .net standard 2.0 (not .net framework 4.8). Due to complexity, I can't spend time supporting the old .net csproj project type.

ghost commented 4 years ago

Project is pretty alive. .NET framework is dead

And it is bad, I still support a big WinForms project

ghost commented 4 years ago

I think the reason people think the project is dead is because the last official non-beta release was a long time ago, and it's confusing as hell when you go to nuget.org and search for Razorlight package.

Exactly, but I'm glad that you work on the project.

jzabroski commented 4 years ago

Best way to show appreciation is to provide good issues that don't require lots of time to understand. Please open a new issue rather than continue commenting on a 4 year old issue. Thank you!

toddams commented 4 years ago

@dlopatin-ms for .NET framework there is an alternative https://github.com/Antaris/RazorEngine

If it's urgent for you

ghost commented 4 years ago

@dlopatin-ms for .NET framework there is an alternative https://github.com/Antaris/RazorEngine

If it's urgent for you

RazorEngine really died two years ago))

We are discussing so far to move functionality to microservice. I basically agree with @jzabroski - there is no big reason to support old framework.

codingawayy commented 3 years ago

@jzabroski @toddams just wanted to follow up and see if NET Framework 4.7 supported at this time? I've tried using 2.0.0-rc.3 on a NET 4.7.2 project but keep getting The type or namespace name 'Razor' does not exist in the namespace 'RazorLight'.

I can of course use https://github.com/Antaris/RazorEngine instead, but wanted to check with you first. Thank you.