Windows를 위한 응용 프로그램 테스트

Windows 8.1 이상에서는 GetVersionGetVersionEx 함수가 더 이상 사용되지 않습니다. Windows 10 기준으로 VerifyVersionInfo 함수도 더 이상 사용되지 않습니다. 더 이상 사용되지 않는 함수를 호출할 수 있지만 애플리케이션이 Windows 8.1 이상을 구체적으로 대상으로 지정하지 않으면 함수는 Windows 8 버전(6.2)을 반환합니다.

참고

GetVersion, GetVersionEx, VerifyVersionInfo버전 도우미 함수 는 데스크톱 앱에만 사용됩니다. 유니버설 Windows 앱은 원격 분석 및 진단 로그에 AnalyticsInfo.VersionInfo 속성을 사용할 수 있습니다.

앱이 Windows 8.1 이상을 대상으로 지정하려면 앱의 실행 파일에 대한 앱(실행 파일) 매니페스트를 포함해야 합니다. 그런 다음 매니<페스트의 호환성> 섹션에서 앱이 지원하는 것을 선언하려는 각 Windows 버전에 대해 supportedOS> 요소를 추가<해야 합니다.

다음 예제에서는 Windows Vista에서 Windows 11 모든 버전의 Windows를 지원하는 앱에 대한 앱 매니페스트 파일을 보여 줍니다.

<!-- example.exe.manifest -->
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
    <assemblyIdentity
        type="win32"
        name="Contoso.ExampleApplication.ExampleBinary"
        version="1.2.3.4"
        processorArchitecture="x86"
    />
    <description>Contoso Example Application</description>
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
            <!-- Windows 10 and Windows 11 -->
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
            <!-- Windows 8.1 -->
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
            <!-- Windows 8 -->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
            <!-- Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
            <!-- Windows Vista -->
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> 
        </application>
    </compatibility>
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
            <requestedPrivileges>
                <!--
                  UAC settings:
                  - app should run at same integrity level as calling process
                  - app does not need to manipulate windows belonging to
                    higher-integrity-level processes
                  -->
                <requestedExecutionLevel
                    level="asInvoker"
                    uiAccess="false"
                />   
            </requestedPrivileges>
        </security>
    </trustInfo>
</assembly>

앱 매니페스트에서 Windows 8.1 이상에 대한 지원을 선언해도 이전 운영 체제에서 앱을 실행할 때는 아무런 영향을 주지 않습니다.

위의 앱 매니페스트에는 시스템에서 UAC(사용자 계정 컨트롤)와 관련하여 처리하는 방법을 지정하는 trustInfo> 섹션도 포함되어< 있습니다. trustInfo를 추가하는 것은 필수는 아니지만 앱에 특정 UAC 관련 동작이 필요하지 않은 경우에도 권장됩니다. 특히 trustInfo 를 전혀 추가하지 않으면 32비트 x86 버전의 앱에는 UAC 파일 가상화가 적용됩니다. 그러면 Windows 시스템 폴더와 같은 관리자 권한 폴더에 대한 쓰기가 실패할 때 성공할 수 있지만 사용자별 "VirtualStore" 폴더로 리디렉션됩니다.