Application Manifest file not loading when having isolated COMReferences
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Description
_Update:
Created a minimal repro here: https://github.com/vruss/net8-app-manifest-bug
You will see that the Framework build works fine but the NET8 build doesn't run fine._
I have run into an issue with a Framework 4.8 to NET 8 upgrade that has to do with the Application Manifest not loading or working when I have COMReferences in my .csproj file.
**Without the COMReferences:**

**With the COMReferences:**

Notice that I have 2 Application Manifest files after adding the COMReferences.
I have done a text-diff on both Manifest files when building a Framework 4.8 and NET 8 build and they are identical. This leads me to believe there is something wrong with the runtime of NET 8 and not the SDK.
**App.manifest:**
```
```
**Generated manifest:**
```
DwijLRVRyiWmJP4/F+2mTIJWDJ4=
u/tvvN735Z/2J+OO3wvqEon2SOg=
```
### Reproduction Steps
1. Create 2 WinForms projects: one in Framework 4.8 and one in NET 8.
2. Add an Application Manifest to both projects and set `requireAdministrator` to true.
2.1. Build and run and you will see the UAC prompt as expected.
3. Add to the .csproj a COMReference. I am guessing it has to be Isolated. Just make sure that a second Application Manifest is generated for you when you build.
3.1. Build and run and you will see the UAC when running the Framework program but no UAC when running NET8.
The UAC is just an easy way for me to verify if the Application Manifest is loaded. I noticed this issue because my Win10 compatibility was not working.
**Example of what my csprojs looks like:**
```
WinExe
net8.0-windows
enable
true
enable
app.manifest
PreserveNewest
{E12DC790-3A8E-456B-AFDE-CA8F570E740B}
1
0
0
tlbimp
True
True
{DB83C810-C405-4DF2-8949-B40B5BB65B71}
1
0
0
tlbimp
True
True
```
```
WinExe
net48
true
app.manifest
PreserveNewest
{E12DC790-3A8E-456B-AFDE-CA8F570E740B}
1
0
0
tlbimp
True
True
{DB83C810-C405-4DF2-8949-B40B5BB65B71}
1
0
0
tlbimp
True
True
```
### Expected behavior
I expect the Application Manifest to be respected and working in NET 8, the same way it did in Framework 4.8.
### Actual behavior
The Application Manifest is ignored.
### Regression?
Worked in Framework 4.8
### Known Workarounds
#### Isolated false
Changing the COMReference import to be `False` fixed the issue for me.
#### Isolated true
1. [Download rcedit](https://github.com/electron/rcedit)
2. `$ rcedit "path-to-exe" --application-manifest "./path/to/app.manifest"`
### Configuration
NET 8.0.204
Windows 10
x64
WinForms
### Other information
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.