MSBuild 조건MSBuild Conditions
MSBuildMSBuild는 Condition
특성이 허용될 때마다 적용할 수 있는 특정 조건 집합을 지원합니다. supports a specific set of conditions that can be applied wherever a Condition
attribute is allowed. 다음 표에서는 이러한 조건에 대해 설명합니다.The following table explains those conditions.
조건Condition | 설명Description |
---|---|
'stringA ' == 'stringB ''stringA ' == 'stringB ' |
stringA 가 stringB 와 같으면 true 로 평가됩니다.Evaluates to true if stringA equals stringB .예:For example: Condition="'$(CONFIG)'=='DEBUG'" 간단한 영숫자 문자열 또는 부울 값에는 작은따옴표가 필요하지 않습니다.Single quotes are not required for simple alphanumeric strings or boolean values. 그러나 빈 값에는 작은따옴표가 필요합니다.However, single quotes are required for empty values. |
'stringA ' != 'stringB ''stringA ' != 'stringB ' |
stringA 가 stringB 와 같지 않으면 true 로 평가됩니다.Evaluates to true if stringA is not equal to stringB .예:For example: Condition="'$(CONFIG)'!='DEBUG'" 간단한 영숫자 문자열 또는 부울 값에는 작은따옴표가 필요하지 않습니다.Single quotes are not required for simple alphanumeric strings or boolean values. 그러나 빈 값에는 작은따옴표가 필요합니다.However, single quotes are required for empty values. |
<, >, <=, >=<, >, <=, >= | 피연산자의 숫자 값을 평가합니다.Evaluates the numeric values of the operands. 관계형 평가가 true이면 true 를 반환합니다.Returns true if the relational evaluation is true. 피연산자는 10진수 또는 16진수 숫자로 평가되어야 합니다.Operands must evaluate to a decimal or hexadecimal number. 16진수는 "0x"로 시작해야 합니다.Hexadecimal numbers must begin with "0x". 참고: XML에서는 < 및 > 문자를 이스케이프해야 합니다.Note: In XML, the characters < and > must be escaped. < 기호는 < 로 표시됩니다.The symbol < is represented as < . > 기호는 > 로 표시됩니다.The symbol > is represented as > . |
Exists('stringA ')Exists('stringA ') |
이름이 stringA 인 파일이나 폴더가 있으면 true 로 평가됩니다.Evaluates to true if a file or folder with the name stringA exists.예:For example: Condition="!Exists('$(builtdir)')" 간단한 영숫자 문자열 또는 부울 값에는 작은따옴표가 필요하지 않습니다.Single quotes are not required for simple alphanumeric strings or boolean values. 그러나 빈 값에는 작은따옴표가 필요합니다.However, single quotes are required for empty values. |
HasTrailingSlash('stringA ')HasTrailingSlash('stringA ') |
지정한 문자열에 후행 백슬래시(\) 또는 슬래시(/) 문자가 있는 경우 true 로 평가됩니다.Evaluates to true if the specified string contains either a trailing backward slash (\) or forward slash (/) character.예:For example: Condition="!HasTrailingSlash('$(OutputPath)')" 간단한 영숫자 문자열 또는 부울 값에는 작은따옴표가 필요하지 않습니다.Single quotes are not required for simple alphanumeric strings or boolean values. 그러나 빈 값에는 작은따옴표가 필요합니다.However, single quotes are required for empty values. |
!! | 피연산자가 false 로 평가되면 true 로 평가됩니다.Evaluates to true if the operand evaluates to false . |
그리고And | 피연산자가 true 로 평가되면 true 로 평가됩니다.Evaluates to true if both operands evaluate to true . |
또는Or | 피연산자 중 하나 이상이 true 로 평가되면 true 로 평가됩니다.Evaluates to true if at least one of the operands evaluates to true . |
()() | 내부에 포함된 식이 true 로 평가되면 true 로 평가되는 그룹화 메커니즘입니다.Grouping mechanism that evaluates to true if expressions contained inside evaluate to true . |
$if$ ( %expression% ), $else$, $endif$$if$ ( %expression% ), $else$, $endif$ | 지정한 %expression% 이 전달된 사용자 지정 템플릿 매개 변수의 문자열 값과 일치하는지를 확인합니다.Checks whether the specified %expression% matches the string value of the passed custom template parameter. $if$ 조건이 true 로 평가되면 해당 문이 실행되고 그렇지 않으면 $else$ 조건이 확인됩니다.If the $if$ condition evaluates to true , then its statements are run; otherwise, the $else$ condition is checked. $else$ 조건이 true 이면 해당 문이 실행되고 그렇지 않으면 $endif$ 조건이 식 평가를 종료합니다.If the $else$ condition is true , then its statements are run; otherwise, the $endif$ condition ends expression evaluation.사용법의 예제는 Visual Studio 프로젝트/항목 템플릿 매개 변수 논리를 참조하세요.For examples of usage, see Visual Studio Project/Item Template Parameter Logic. |
참고 항목See Also
MSBuild 참조 MSBuild Reference
조건부 구문 Conditional Constructs
연습: 처음부터 새로 MSBuild 프로젝트 파일 만들기Walkthrough: Creating an MSBuild Project File from Scratch