게시하기 전에 Project -> Properties -> Options -> File Associations에 가서 ".hsp"확장자를 추가했습니다. 아이콘과 ProgID (테스트를 위해 "MyCompany.Document.1")를 설정하십시오. 내가 게시하고 설치 한 후에는 .hsp 파일에 아이콘이 설정되어 있으므로 파일 연결이 제대로 설정되어야합니다. 그러나이 파일 중 하나를 두 번 클릭하면 응용 프로그램이 실행되고 두 번 클릭 한 파일의 이름을 예상했습니다. 명령 줄에서. 내 Main
함수에 전달 된 매개 변수를 읽으려고했는데 Environment.CommandLine
을 시도하고 Environment.GetCommandLineArgs()
을 시도했지만 응용 경로 만 발견했습니다. 그런데 나는이 테스트를 Main
함수에서 기본 폼을 만들기 전에 테스트하고 있습니다. args
매개 변수는 비어 있으며 나머지 두 매개 변수는 내 앱 경로 만 포함합니다.ClickOnce 응용 프로그램에서 명령 줄을 얻는 방법은 무엇입니까?
static void Main(string[] args)
{
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
MessageBox.Show("CommandLine -> " + Environment.CommandLine);
foreach (string str in args) MessageBox.Show("args -> " + str);
foreach (string str in Environment.GetCommandLineArgs()) MessageBox.Show("GetCommandLineArgs -> " + str);
너무 감사합니다! – pr0gg3r