Frage

When trying to run the 7-Zip command line .exe from within a C# Windows service my application hangs without throwing an error. Setting breakpoints at the section below showed that the hang occurs once I hit Process.Start(p). I put the same code in a Windows forms app and got the "Open File - Security Warning" message box that states that the publisher could not be verified. Clicking "Run" on the warning caused it to proceed without any problems. Is there a way outside of unchecking the "Always ask before opening this file" box to suppress this warning?

My code is as follows:

ProcessStartInfo p = new ProcessStartInfo();
p.FileName = "7za.exe";

p.Arguments = "a -tzip \"" + targetName + "\" \"" + sourceName + "\" -mx=9";
p.WindowStyle = ProcessWindowStyle.Hidden;

Process x = new Process();
x = Process.Start(p);
x.WaitForExit();

Thanks in advance for your help.

War es hilfreich?

Lösung

right click on the 7z exe in windows explorer, and there should be an "unblock" button in the file properties. click it and then click apply, that should stop it on your computer, but unfortunately, its just part of windows now for any exe downloaded from the internet and not signed.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top