Todd
Todd

Reputation: 233

Blazor file access

AppDomain.CurrentDomain.BaseDirectory gives me the bin directory in server-side blazor. But when I go to client-side wasm this same call return "/". Just a root. How do I carry a file in the root of the client app and then use it in the client? Thanks!

Upvotes: 1

Views: 1419

Answers (2)

Manuel Fuchs
Manuel Fuchs

Reputation: 417

Have a look at Assembly.GetManifestResourceStream.

Here's a stackoverflow post discussing on how to use it.

Your workaround using another service returning the resource works for applications with internet access, but is not an option in an offline scenario. In my case, I simply needed a font file and embedding the file into the assembly worked just fine.

Upvotes: 1

Todd
Todd

Reputation: 233

It seems as if it is not possible. To work around, I will be creating a service that runs on the host.

Upvotes: 0

Related Questions