How to add Rotativa.aspnetcore configuration in Program.cs instead of RotativaConfiguration.Setup(env); that was in Startup.cs in .NET 5 and below?
What I have tried this in Program.cs:
var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
RotativaConfiguration.Setup(env);
Thanks
In .Net 5 or below version, the configure method like this:
In .NET 6, there are a few common services available as top level properties on
WebApplicationand additional services need to be manually resolved from theIServiceProviderviaWebApplication.Services.So in your project, You can just configure like this:
For more information on the difference between the configuration files in
.Net 6andother version, please refer to this link