2010-02-01 5 views
3

Visual C# Express 2008을 사용하고 있습니다. "릴리스"빌드에서 실행되는 특수 명령을 원합니다. 디버그 버전을 만들고 실행하는 동안이 명령을 실행해서는 안됩니다. 내 빌드 유형 (디버그 또는 릴리스)에 따라 코드를 구현할 수 있습니까? 예를 들어코드는 빌드 유형에 따라 다릅니 까?

:

if(??buildtype?? == "Release") 
{ 
//... special command ... 
MessageBox.Show("RELEASE version"); 
} 
else 
{ 
//... normal command ... 
MessageBox.Show("debug release"); 
} 

답변

11
#if DEBUG 
    // Commands that should run in debug builds. 
#else 
    // Commands that should run in release builds. 
#endif 
+0

내가 확인 프로젝트 properies에서 "디버그의 상수를 정의"를해야합니까? – Tobias

관련 문제