I'm trying to include a .CHM (Microsoft Compiled HTML help) documentation file in my WPF application. It is set as a Resource in my application.
I use .NET 5 and I want to create a self-contained application using single file deployment. When I have a .CHM-file on my local machine, I can execute the file to open a default help viewer in Windows.
var p = new Process();
p.StartInfo = new ProcessStartInfo(@"D:\helpfile.chm")
{
UseShellExecute = true
};
p.Start();
I want to do something similar with the resource I am including in my project. However, in a single file deployment there is no such thing as file paths (see https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file). As I want to step "out of" the application and send the file to the process, can I send the whole file to a process out of my application?
A workaround might be to create an installer and have the help-file be installed on the user's computer, but that kind of defeats the whole point of having single file deployment.
Application.GetResourceStream()
to get the contents of your embedded CHM as a binary stream.System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".chm"
to get a temporary file name, and open that file as a binary stream.