I've been tasked with building a custom updater but are struggling with how to run this. I could of course just create a separate app to take care of this but it is preferred that it all stay in the same solution. In my solution I have the project "Main" which is a Forms application and the project "AutoUpdater" which is a console application.
My idea was to have "Main" run the "AutoUpdater" console app in a separate process or possibly have the program copy the autoupdater.exe in a temp folder and then run it from there (to prevent file lock)
But how to I tell Main to run AutoUpdater?
您可以使用Process.Start
通过提供路径来运行 AutoUpdater exe。
in your main declare a using.
using AutoUpdater;
Then you have easy acces to start the Console.
Use the AutoUpdater project's Post build event to copy the output to a location where the Main application can access.
Read more here : https://docs.microsoft.com/en-us/visualstudio/ide/how-to-specify-build-events-csharp?view=vs-2019
and/or you can add the AutoUpdater's directory to Path Environment variable and use just the executable name in Process.Start method.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.