# Visual studio vs\_link\_exe/manifest Questions...

**URL:** https://discourse.cmake.org/t/visual-studio-vs-link-exe-manifest-questions/6441
**Category:** Development
**Created:** [September 8, 2022, 5:48pm UTC](https://discourse.cmake.org/t/visual-studio-vs-link-exe-manifest-questions/6441 "2022-09-08T17:48:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![KUGA2](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kuga2/32/4968_2.png) [@KUGA2](https://discourse.cmake.org/u/KUGA2)
#### Post date: [September 8, 2022, 5:48pm UTC](https://discourse.cmake.org/t/visual-studio-vs-link-exe-manifest-questions/6441/1 "2022-09-08T17:48:36Z")

</div>

The linker with Visual studio and ninja is very complicated.

It runs:  
`cmake.exe -E vs_link_exe --intdir=Components\OSBase\Common\Temperature\UnitTest\CMakeFiles\UT_temperature.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100203~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100203~1.0\x64\mt.exe --manifests -- C:\PROGRA~2\MIB055~1\2019\PROFES~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\link.exe /nologo ...`

vs\_link\_exe is explained nowhere in documentation. You can find it in source code ([cmcmd.cxx](https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/cmcmd.cxx)). There it states:

```auto
// For visual studio 2005 and newer manifest files need to be embedded into
// exe and dll's. This code does that in such a way that incremental linking
// still works.

```

However, you can disable embedding manifest files in Visual Studio. See [here](https://techsupportwhale.com/mt-exe-general-error-c101008d-failed-to-write-the-updated-manifest-to-the-resource-of-file/).

I cannot find the option to remove embedding manifest files. Do I need to patch the linker command that is created by [Windows-MSVC.cmake](https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/Platform/Windows-MSVC.cmake)?

What would you think of a patch retries mt.exe a few times ([here](https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/cmcmd.cxx#L2485))? The antivirus issue linked above must affect more people then me… See also on [Stack Overflow](https://stackoverflow.com/questions/3775406/mt-exe-general-error-c101008d-failed-to-write-the-updated-manifest-to-the-res).

btw: why was linking (non-incremental) implemented as C+±code? Why not call `link.exe ... && mt.exe ...`? What is incremental linking and when is it used?

Also, something I saw, which is quite strange: The linker commandlines for Debug and Release are very similar. However, in Release, my CMAKE\_RUNTIME\_OUTPUT\_DIRECTORY contains \*.manifest files, while the Debug does not.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [September 8, 2022, 5:55pm UTC](https://discourse.cmake.org/t/visual-studio-vs-link-exe-manifest-questions/6441/2 "2022-09-08T17:55:19Z")

</div>

Cc: @brad.king

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [September 9, 2022, 2:47pm UTC](https://discourse.cmake.org/t/visual-studio-vs-link-exe-manifest-questions/6441/3 "2022-09-09T14:47:08Z")

</div>

Cc: @bill.hoffman

See the code [here](https://gitlab.kitware.com/cmake/cmake/-/blob/v3.24.1/Source/cmcmd.cxx#L2310) for more details on the series of steps needed to support both embedded manifests and incremental linking.

> I cannot find the option to remove embedding manifest files.

I don’t think we have one. You could search the issue tracker to see if this has been raised already, and if not, open a feature request to discuss design ideas.
