ihostingenvironment has been converted to IWebHostEnvironment in dot net core 3.1
ihostingenvironment has been converted to IWebHostEnvironment in dot net core 3.1 so RotativaConfiguration.Setup(env) not working
Yea if there's some way to do work, please tell us how to do thanks
Same problem here
what I see they haven't made the version for 3.x yet :( I'm sorry because you see that the tool is very good
Until the new version comes out for IWebHostEnvironment, I am casting it it IHostingEnvironment. Seem to work. Hopefully this will be temporary.
So in Startup.cs where you do:
RotativaConfiguration.Setup(env, "...."); replace with:
RotativaConfiguration.Setup((Microsoft.AspNetCore.Hosting.IHostingEnvironment)env, "....");
VS will complain it's Obsolete, so just add [Obsolete] attribute to Startup function.
What worked for me was this from ReadMe.md:
Basic configuration done in Startup.cs:
RotativaConfiguration.Setup(env);or, if using Asp.net Core 3.0:
RotativaConfiguration.Setup("<root path here>", "path/relative/to/root");Make sure you have a folder with the wkhtmltopdf.exe file accessible by the process running the web app. By default it searches in a folder named "Rotativa" in the root of the web app. If you need to change that use the optional parameter to the Setup call RotativaConfiguration.Setup(env, "path/relative/to/root")
So i changed my code in Setup.cs to:
RotativaConfiguration.Setup(env.ContentRootPath, "wwwroot/Rotativa");
-> this worked
Until the new version comes out for IWebHostEnvironment, I am casting it it IHostingEnvironment. Seem to work. Hopefully this will be temporary.
So in Startup.cs where you do:
RotativaConfiguration.Setup(env, "....");replace with:RotativaConfiguration.Setup((Microsoft.AspNetCore.Hosting.IHostingEnvironment)env, "....");VS will complain it's Obsolete, so just add [Obsolete] attribute to Startup function.
Thanks Jsoques this work perfectly
What worked for me was this from ReadMe.md:
Basic configuration done in Startup.cs:
RotativaConfiguration.Setup(env);or, if using Asp.net Core 3.0:RotativaConfiguration.Setup("<root path here>", "path/relative/to/root");Make sure you have a folder with the wkhtmltopdf.exe file accessible by the process running the web app. By default it searches in a folder named "Rotativa" in the root of the web app. If you need to change that use the optional parameter to the Setup call RotativaConfiguration.Setup(env, "path/relative/to/root")So i changed my code in Setup.cs to:
RotativaConfiguration.Setup(env.ContentRootPath, "wwwroot/Rotativa");-> this worked
Hi MrCodeB2 well I'm using asp core 3.1 and don't work this way, but thanks by share maybe someone uses 3.0, this works
What worked for me was this from ReadMe.md:
Basic configuration done in Startup.cs:
RotativaConfiguration.Setup(env);or, if using Asp.net Core 3.0:RotativaConfiguration.Setup("<root path here>", "path/relative/to/root");Make sure you have a folder with the wkhtmltopdf.exe file accessible by the process running the web app. By default it searches in a folder named "Rotativa" in the root of the web app. If you need to change that use the optional parameter to the Setup call RotativaConfiguration.Setup(env, "path/relative/to/root")So i changed my code in Setup.cs to:
RotativaConfiguration.Setup(env.ContentRootPath, "wwwroot/Rotativa");-> this workedHi MrCodeB2 well I'm using asp core 3.1 and don't work this way, but thanks by share maybe someone uses 3.0, this works
<TargetFramework>netcoreapp3.1</TargetFramework>
I am using 3.1 also and its working :-)
https://github.com/webgio/Rotativa.AspNetCore/issues/49
What worked for me was this from ReadMe.md:
Basic configuration done in Startup.cs:
RotativaConfiguration.Setup(env);or, if using Asp.net Core 3.0:RotativaConfiguration.Setup("<root path here>", "path/relative/to/root");Make sure you have a folder with the wkhtmltopdf.exe file accessible by the process running the web app. By default it searches in a folder named "Rotativa" in the root of the web app. If you need to change that use the optional parameter to the Setup call RotativaConfiguration.Setup(env, "path/relative/to/root")So i changed my code in Setup.cs to:
RotativaConfiguration.Setup(env.ContentRootPath, "wwwroot/Rotativa");-> this workedHi MrCodeB2 well I'm using asp core 3.1 and don't work this way, but thanks by share maybe someone uses 3.0, this works
there is a beta in nuget. and its working
<PackageReference Include="Rotativa.AspNetCore" Version="1.2.0-beta" />
@abdoneemmsc maybe close issue?
env.ContentRootPath
This doen't work because Setup method waiting for IHostingEnvironment parameter and you are passing a string, this causses problem.
I think the solution is updating de method to use IWebHostEnvironment. I am not sure.