<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/120394>120394</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-cl] Generates bad manifest XML for Visual Studio UAC settings
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          d3x0r
      </td>
    </tr>
</table>

<pre>
    This is an example of where the settings get set.

![Image](https://github.com/user-attachments/assets/22bc8e9b-574d-4f37-a66d-abbb791d579e)


Clang-CL generates XML that looks like this

``` xml
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <ms_asmv1:trustInfo xmlns="urn:schemas-microsoft-com:asm.v3" xmlns:ms_asmv1="urn:schemas-microsoft-com:asm.v1">
 <ms_asmv1:security>
      <ms_asmv1:requestedPrivileges>
 <ms_asmv1:requestedExecutionLevel ms_asmv1:level="requireAdministrator" ms_asmv1:uiAccess="false"/>
      </ms_asmv1:requestedPrivileges>
 </ms_asmv1:security>
  </ms_asmv1:trustInfo>
</assembly>
```

Where a good manifest looks like

``` xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
 <requestedPrivileges>
                <requestedExecutionLevel
 level="requireAdministrator" uiAccess="false"></requestedExecutionLevel>
 </requestedPrivileges>
        </security>
 </trustInfo>
</assembly>
```

When the clang generated manifest is used in the program the porgram throws a 'side-by-side installation error' sort of error...  

`The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.`


when using the sxstrace tool gave me an error message when I did a profile and converted it to a log...

```
        ERROR: Line 6: The required attribute level is missing from element requestedExecutionLevel.
```

`level` is what it's looking for not `ms_asmv1:level` apparently.  There's no automatic namespacing of tags in most path/node based xml parsers....

I could fall back and run a `mt.exe ...` command and embed a correct manifest while this is broken... but really respecting the options and building the file should work.   

This causes a service or admin tool to not be able to run.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8lk1v4zYTgH8NfRlIkClbtg4-eJP4RYC86GK7u-2toKSRxIYiXQ7lxP--GMpxnKRpd7tADQP6mhnOx8PhKCLdWcSNWH4Qy-uZGkPv_KbJHzM_q1xz3HzuNYEmUBbwUQ17g-BaeOjRI4QegTAEbTuCDgM_pCLb8l_OxfLD7aA6FMtrIdd9CHsS-VbInZC7Tod-rNLaDULuRkKfqBBU3Q9oAwm5U0QYb6Ss6jWWVbJcLZpk0earRBVFk6iqqlblvFmuShSyPC2aba-Msl1ydQcdWvQqIMGv_7-D0KsAxrl7AqPv2XNNJ50im_7wOBh-zq9EvnscDBzQk3ZW5NdCynmaCSkBbe0abbvp5ZfPu2QtpBT5TuQ3kzJ7PlTmyOYsTXKjtyLfUt3joCgZdO0duTYkHH6-VTSkhzlbH5TVLVL4-nblyT6AyK8G-k3RcJiLfBv8SOHWtu47V8t5tZPK9tned_h68uelO4T16HU4PjnLv5cSHv8YkQI2H70-aIMd0l9aOsvdPGI9Bu3sHR7QwIWI4ReTzyytPW6bQVtNwavgfMzns_Sot3WNdEpRqwwhRyF3r3wVcvet7r4UfR37G4Fzrc6onDhnWk7vnlic0PwlbjIFnXPNmY0Lin8c4DG0EWCgoGyjjLM4fTgi_bdcx4T9CM6XdYzGXhVE5FfvV_PV71L2JYAs_A3gvUNbfjNV_T3jl2j9o7OT2Nsohdz9K9RsbOc1989z87zAThOMhA3oSW7vXefVMN07f7r37oFAgZAr0g0m1THhK2hLQRmjOFJA7zlJKyDnA58l8UWapgBnoD_3CGq_N7qedHpF0CptsIHgGFYfoMJajYSgA8GL1WpnW92NflLl08vWznusQwofDSriQ2s6vC7XwANa3l0dOM-hTulww6BskxhtEeiRS1xjio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