Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4317

Blazor can't load image from class library at publish

$
0
0

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


Viewing all articles
Browse latest Browse all 4317

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>