-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
OrchardCore.Cms.Web, Mvc.Web and Templates with .NET 6 #10762
Conversation
seems to cause an error:
|
We can't have this because of multi-targeting. Same issue as on OrchardCore.Commerce recently. |
Example repo to repro the error using |
@deanmarcussen or @Skrypt Can you please have a look to the NLog error? |
WebHost is legacy and now obsolete with NET6. Instead use Host:
And change from public static class WebHostBuilderExtensions
{
public static IHostBuilder UseNLogWeb(this IHostBuilder builder)
{
LayoutRenderer.Register<TenantLayoutRenderer>(TenantLayoutRenderer.LayoutRendererName);
builder.UseNLog();
builder.ConfigureAppConfiguration((context, configuration) =>
{
var environment = context.HostingEnvironment;
NLog.LogManager.Setup()
.LoadConfigurationFromFile(System.IO.Path.Combine(environment.ContentRootPath, "NLog.config"))
.LoadConfiguration(builder => builder.Configuration.Variables["configDir"] = environment.ContentRootPath);
});
return builder;
}
} Notice NLog.Web.AspNetCore ver. 5.0 will automatically attempt to load NLog.config from ContentRootPath. And one can use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snakefoot thanks for the assist.
@agriffard this needs the same for the Mvc templates / program.cs / startup.cs
You could take this out of draft :)
src/Templates/OrchardCore.ProjectTemplates/content/OrchardCore.Templates.Cms.Web/Program.cs
Outdated
Show resolved
Hide resolved
Mvc sample and template updated. |
Could be merged, now that we use .NET 6. |
I'm ok with it if we merge we will have time to adjust if any breaking change is introduced. |
src/Templates/OrchardCore.ProjectTemplates/content/OrchardCore.Templates.Mvc.Web/Program.cs
Outdated
Show resolved
Hide resolved
Needs testing around razor compilation with implicit using. Niraj mentions there is an issue with that. |
@agriffard @Skrypt Updated Program.cs and fix merge conflict |
This reverts commit 6f72be0.
@agriffard @Skrypt @sebastienros @deanmarcussen @hishamco Can you please review the updates?. |
@sebastienros for OrchardCore.Web conditional enable implicit using based on RazorCompilation value. |
Use only
Program.cs
Options in csproj:
Docs updated.
Templates updated.
Fixes #11932