728x90
728x170
■ 업데이트 프로그램을 강제 실행하는 코드를 추가하는 방법을 보여준다.
▶ Program.cs
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
namespace TestProject
{
/// <summary>
/// 프로그램
/// </summary>
static class Program
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Static
//////////////////////////////////////////////////////////////////////////////// Private
#region 프로그램 시작하기 - Main()
/// <summary>
/// 프로그램 시작하기
/// </summary>
[STAThread]
private static void Main()
{
try
{
string path = Path.Combine(Application.StartupPath, "updater.exe");
if(File.Exists(path))
{
Process process = Process.Start(path, "/silentall");
process.WaitForExit();
if(process.ExitCode == 0)
{
return;
}
}
}
catch
{
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
#endregion
}
}
728x90
그리드형(광고전용)
'C# > Advanced Installer' 카테고리의 다른 글
[C#/ADVANCED INSTALLER] updates.txt 파일 정보 구하기 (0) | 2021.09.12 |
---|---|
[C#/ADVANCED INSTALLER] 커스텀 액션을 사용해 윈도우즈 서비스 실행하기 (기능 개선) (0) | 2021.08.31 |
[C#/ADVANCED INSTALLER] 커스텀 액션을 사용해 윈도우즈 서비스 실행하기 (0) | 2021.01.09 |
[C#/ADVANCED INSTALLER] 커스텀 액션 사용하기 (0) | 2021.01.05 |