2012-10-16 3 views
-1

프로그램이 컴퓨터에 설치되어 있는지 (Clickonce를 사용하여) 또는 실행 중인지 (예 : Visual Studio) 확인하고 싶습니다.실행중인 응용 프로그램이 설치되어 있는지 여부를 프로그래밍 방식으로 확인하는 방법?

편집 : How to detect that C# Windows Forms code is executed within Visual Studio?의 중복이 아닙니다. "예" 의미는 for example을 의미합니다.

+0

@downvoter 왜 그런지 설명해 주시겠습니까? 명백한 대답? (글쎄, 난 몰라.) 쉽게 찾을 수있어? (먼저 시도해보십시오.) – ispiro

+1

(다운 voter가 아닙니다)이 웹 사이트 또는 winforms 응용 프로그램입니까? 후자의 경우이 질문을보십시오. http://stackoverflow.com/questions/2427381/how-to-detect-that-c-sharp-winform-code-is-executed-within-visual-studio –

+0

@BobKaufman 태그 - Winforms. (중요합니까?) – ispiro

답변

3

ApplicationDeployment.IsNetworkDeployed 속성을 사용할 수 있습니다. 이 옵션은 ClickOnce 설치에서만 작동합니다.

private void CheckApplicationStatus() { 
    if (ApplicationDeployment.IsNetworkDeployed) { 
     // Do something that needs doing when the application is installed using ClickOnce. 
    } else { 
     // Do something that needs doing when the application is run from VS. 
    } 
} 
+0

Perfect. 감사. – ispiro

관련 문제