mt.exe를 사용하여 실행 파일에 매니페스트를 추가하려면 어떻게합니까?

StackOverflow https://stackoverflow.com/questions/1423492

  •  07-07-2019
  •  | 
  •  

문제

Windows SDK에서 mt.exe를 사용하여 다음 명령 줄을 사용하여 실행 파일이없는 실행 파일에 매니페스트를 추가하려고합니다.

C:\winsdk61>mt.exe -nologo -manifest "r:\shared\hl.exe.manifest" -updateresource:"r:\shared\hl33m.exe;#1"

불행히도, 내가 할 때, 나는이 오류를 얻는다 :

mt.exe : general error c101008c: Failed to read the manifest from
the resource of file "r:\shared\hl33m.exe". The specified resource
type cannot be found in the image file.

물론 파일에는 리소스가 발견되지 않았습니다. 파일에는 매니페스트가 없기 때문에 추가하고 싶습니다.

실행 파일에 매니페스트를 추가하려면 어떻게해야합니까? 이것이 단순하지 않아야합니까?

도움이 되었습니까?

해결책

당신은 사용해야합니다 /outputResource 대신에 /updateResource :.

올바른 명령 줄은 다음과 같습니다.

mt.exe -nologo -manifest "r:\shared\hl.exe.manifest" -outputresource:"r:\shared\hl33m.exe;#1"

다른 팁

이것은 VS 2005에서 저에게 효과가있었습니다.

  1. Exection Manifest와 함께 실행 파일의 이름을 따서 명명 된 텍스트 파일을 작성하고 코드 파일과 동일한 경로에 있는지 확인하십시오. 예를 들어, 앱 이름이 uactester.exe 인 경우 Manifest 파일이 uactester.exe.manifest로 명명되어야합니다.
  2. 매니페스트의 내용이 양호한 지 확인하십시오. 나는 이것을 사용한다 :
    <?xml version="1.0" encoding="utf-8"?>
    <asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"
     xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" 
     xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
        <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
            <security>
                <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
                    <requestedExecutionLevel level="requireAdministrator" 
                     uiAccess="false" />
                </requestedPrivileges>
                <applicationRequestMinimum>
                    <defaultAssemblyRequest permissionSetReference="Custom" />
                    <PermissionSet class="System.Security.PermissionSet" 
                     version="1" ID="Custom" SameSite="site" />
                </applicationRequestMinimum>
            </security>
        </trustInfo>
        <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
            <application>
            </application>
        </compatibility>
    </asmv1:assembly>
  1. 실행 가능한 프로젝트에서 빌드 후 이벤트를 추가하십시오.

    "$(DevEnvDir)..\Tools\Bin\mt.exe" -nologo -manifest "$(TargetPath).manifest" -outputresource:"$(TargetPath)"

도움이 되었기를 바랍니다. 행운을 빕니다! -matt esterak

이와 같이 사용하여 EXE 파일 내부에 매니페스트를 포함시킬 수도 있습니다.

mt.exe -nologo -manifest "r : shared hl.exe.manifest"-outputresource : "r : shared hl33m.exe; 1"

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top