In another question I made here.
I was asking about rendering HTML to an image stream/image base64 dataURI.
I was successful with this task by using Puppeteersharp which worked perfectly (class code for my HTML to Base64 Image renderer is posted as a separate answer there).
But now, our deployment team is having issues building the entire solution (6 websites with 20+ projects) using MSBUILD.
Our environment is built on .NET framework 4.8. Normally, when building in either Visual Studio 2019 or Visual Studio 2022, this works fine. Puppeteersharp seems to reference a newer framework but still builds fine in Visual Studio.
But as soon as we use MSBUILD in our production pipeline, the multi-environment build fails and we have narrowed it down to Puppeteer sharp being the core problem.
My question is:
- Is there any workaround when using Puppeteersharp (or other newer libraries) alongside older frameworks when using MSBUILD
- Or, is there any older alternative libraries that work the same way as Puppeteersharp that we could switch to? The libraries would need to be able to render modern inlined HTML/CSS (JS is not required) to a headless browser. And then be able to screenshot the browser entirely on the backend and output to either a temp folder, or preferably an output Stream so we can easily convert it to a base64 image URI.