Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not a valid .NET Core host with .net 8 self hosted but works locally without problem #187

Open
yoganr opened this issue Jun 27, 2024 · 1 comment

Comments

@yoganr
Copy link

yoganr commented Jun 27, 2024

Mono.TextTemplating.TemplatingEngineException: Not a valid .NET Core host
at Mono.TextTemplating.TemplatingEngine.GetOrCreateCompiler() in /_/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs:line 67
at Mono.TextTemplating.TemplatingEngine.CompileCode(IEnumerable1 references, TemplateSettings settings, CodeCompileUnit ccu, CancellationToken token) in /_/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs:line 303 at Mono.TextTemplating.TemplatingEngine.CompileTemplateInternal(ParsedTemplate pt, String content, ITextTemplatingEngineHost host, TemplateSettings settings, CancellationToken token) in /_/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs:line 277 at Mono.TextTemplating.TemplatingEngine.CompileTemplateAsync(String content, ITextTemplatingEngineHost host, CancellationToken token) in /_/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs:line 207 at Mono.TextTemplating.TemplatingEngine.ProcessTemplateAsync(String content, ITextTemplatingEngineHost host, CancellationToken token) in /_/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs:line 82 at Mono.TextTemplating.TemplateGenerator.ProcessTemplateAsync(String inputFileName, String inputContent, String outputFileName, CancellationToken token) in /_/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs:line 172 at DocumentTemplateService.Globals.Implementations.T4TemplateService.T4TemplateService.ProcessTemplate(String template, Dictionary2 parameters)

@UweLesta
Copy link

UweLesta commented Sep 17, 2024

FYI
This error occurs if
you use a package version below 2.3.1
and
your application is published in 'Deployment Mode' = 'Self-contained' (Not 'Framework-dependent')
and
there is no SDK on the server installed.

Mainly, you have to rethink your application if it is really necessary that your t4 template has to be compiled at runtime.

If so, use an appropriate version of Mono.Texttemplating that supports the environment variable DOTNET_ROOT which should point to the installed SDK on the server.

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

No branches or pull requests

2 participants