I have a Blazor component library that has a PDFGenerator
component. I consume this library in a Blazor server application, I have to send path of image to add it in the PDF. In development stage it works fine but after deploying to test server I get an error because of the path.
Server application
var Path="..\\BlazorUI\\Blazor.Components\\wwwroot\\Images\\Logo.png"
Blazor component library:
Image image = section.Headers.Primary.AddImage(ImageSource.FromFile(path));
Error:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Webservice\BlazorUI\Blazor.Components\wwwroot\Images\Logo.png
The path of the Images
folder on the server:
C:\Webservice\application\wwwroot\_content\Blazor.Components\Images
My question:
how can I use dynamic path to work in development stage and also in the test server?
Thanks