mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file … Access is denied

纵然是瞬间 提交于 2019-12-20 10:29:35

问题


I often have this problem even when I build a new C++ project and try to build a release file.

I use Visual studio 2008. One thing that may cause this problem is my code is saved on the server disk, not on local hard disk.

mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file "..\Release\PGTS_version17C.exe". The process cannot access the file because it is being used by another process.

Anyone know how to solve this? Thanks.


回答1:


If you are embedding a manifest file, your anti-virus program may lock and scan your exe file before embedding the manifest.

I recommend disabling anti-virus from reading your DEBUG and RELEASE output folders.




回答2:


Go to Debug and/or Release folder(s), right click and unset, recursively, the Read-Only property.

Found this tip in the MSDN Community and solved my problem!




回答3:


Funny enough I had the exact same error and a "rebuild" on the whole project solved it.




回答4:


It it's not a permissions or actual file access problem (AV)...

You can add a flag to make the compiler check the validity of the manifest.

This validation will fix the problem so you'll never have to rebuild it again.
This is very important for anyone who's running an actual Build-Machine or automatic buildscript where you don't want to manually interfere:

Add this flag:
Project properties -> Configuration Properties -> Manifest Tool -> Command Line -> Additional options:

/validate_manifest



回答5:


disabling the Anti-Virus worked for me.




回答6:


If you need not generate Manifest file, just set it off it will resolve the problem.

Goto Project(right click)

properties

Linker

Manifest Files

Generate Manifest

change it Yes to No

It resolve the problem for me on VS2008 without disabling Anti-virus. ;)

Enjoy :)




回答7:


Open visual studio 2010 as "Run as administrator" and Rebuild again.




回答8:


I worked around this with a "wrapper" program for mt.exe, one that reran it until it succeeded. Save the following code as mt-wrapper.cpp:

#include <windows.h>
#include <stdio.h>
#include <process.h>

// Build from a Visual Studio Command Prompt with "cl /O2 /Gy /Femt.exe mt-wrapper.cpp"

int __cdecl wmain(int argc, WCHAR **argv, WCHAR **env)
{
    // Stop outputting text.
    fclose(stdout);
    fclose(stderr);

    // Run the original mt.exe, which has been renamed to mt-orig.exe .
    for (;;)
    {
        // Try to run the original mt.
        intptr_t iStatus = _wspawnve(_P_WAIT, L"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\mt-orig.exe", argv + 1, env);
        if (iStatus == 0)
            break;

        // Try again, after a short wait.
        ::Sleep(100);
    }

    return 0;
}

Build this program, go to your C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin folder, rename the old mt.exe to mt-orig.exe (and the mt.exe.config to mt-orig.exe.config), and put this wrapper program in there as mt.exe. Now, when you build, it will retry running the original mt.exe until it succeeds.

Oddly, MSBuild doesn't seem to check for a zero status when deciding that mt.exe has succeeded — it seems to look for error messages written to stdout/stderr. So this program closes both of those before spawning the original mt.exe. Anyone feeling industrious can apply the advice found here to save the output of the successful run of the original mt.exe, and output it to stdout/stderr.




回答9:


Try this:

  1. Disable AV
  2. Temporary rename your exe so it doesn't contain any of the words UAC magic words (install, setup, patch, upgrade)
  3. make sure you have write permissions
  4. use mt command to inject the manifest
  5. rename back your exe



回答10:


If you're using Hudson/Jenkins to create releases restarting it solved the problem for me.




回答11:


I solved this error by stopping and disabling the 'Timing Service' (part of FireEye)



来源:https://stackoverflow.com/questions/3775406/mt-exe-general-error-c101008d-failed-to-write-the-updated-manifest-to-the-res

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!