Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Unable to resolve service for type 'Wkhtmltopdf.NetCore.IGeneratePdf' #11

Open
aammfe opened this issue Sep 17, 2020 · 1 comment
Open

Comments

@aammfe
Copy link

aammfe commented Sep 17, 2020

Hello !!
I'm flowing this blog But having issue bcs DI could not find
IGeneratePdf

System.InvalidOperationException: Unable to resolve service for type 'Wkhtmltopdf.NetCore.IGeneratePdf' while attempting to activate 'test.Controllers.WeatherForecastController'

here I have supplied .exe and register Wkhtmltopdf in services
image

this is controller code
image

@Jefferycheng
Copy link

Did you add the property "copy if newer" of the wkhtmlpdf.exe in csproj?

Like this:

  <ItemGroup>
    <None Update="Rotativa\Linux\wkhtmltopdf">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="Rotativa\Mac\wkhtmltopdf">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="Rotativa\Windows\wkhtmltopdf.exe">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>

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

No branches or pull requests

2 participants