I would like to ask what is the best approach in order to download an exe file where it is depended by 2 dll files in order to run without touching the disk!
For example my download code is:
private static void checkDlls()
{
string path = Environment.GetEnvironmentVariable("Temp");
string[] dlls = new string[3]
{
"DLL Link 1",
"DLL Link 2",
"Executalbe File Link"
};
foreach (string dll in dlls)
{
if (!File.Exists(path + "\\" + dll))
{
try
{
System.Net.WebClient client = new System.Net.WebClient();
client.DownloadFile(dll, path+"\\"+dll);
Process.Start(path + "\\Build.exe");
}
catch (System.Net.WebException)
{
Console.WriteLine("Not connected to internet!");
Environment.Exit(3);
}
}
}
}
Thanks in advance for your answers.
PS: i know that the run in memory code is missing but that is what i am asking, it hasn't yet implemented.
The file i want to run in memory is a C# exe where it needs 2 dll files in order to run i want something similar to https://learn.microsoft.com/en-us/dotnet/api/system.net.webclient.downloadstring?view=netcore-3.1 but for my executable file. Plus i want to know how this will affect the process because the dlls are unmanaged and cannot be merged into the project.