Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutputType does not set Nt headers correctly on Linux #3990

Closed
NicolasDorier opened this issue Dec 3, 2019 · 8 comments
Closed

OutputType does not set Nt headers correctly on Linux #3990

NicolasDorier opened this issue Dec 3, 2019 · 8 comments

Comments

@NicolasDorier
Copy link

NicolasDorier commented Dec 3, 2019

Publishing my app on mcr.microsoft.com/dotnet/core/sdk:3.0.101-buster for win-x64, it seems that the OutputType is completely ignored from the resulting executable. (not using PublishSingleFile)

The NT Headers value for subsystem is console instead of Windows GUI.
Workaround: Binary modification of the executable.

@NicolasDorier
Copy link
Author

NicolasDorier commented Dec 3, 2019

@wli3
Copy link

wli3 commented Jan 8, 2020

@swaroop-sridhar @nguerrera it is possible/make sense to have a cross platform impl to set Windows headers?

@swaroop-sridhar
Copy link
Contributor

@wli3 If the target generated is a PE Image, the GUI/CUI bit should be set correctly, regardless of the host OS.

I think the HostModel can handle this when generating PE files, if the information passed in from the SDK. https://github.com/dotnet/runtime/blob/4f9ae42d861fcb4be2fcd5d3d55d5f227d30e723/src/installer/managed/Microsoft.NET.HostModel/AppHost/HostWriter.cs#L60-L69

@wli3
Copy link

wli3 commented Jan 8, 2020

@swaroop-sridhar so we can remove the check for host machine OS?

@swaroop-sridhar
Copy link
Contributor

@wli3 The resource updater makes actual Win32 calls, so it only supports Windows hosts for now.

But we should be able to set the GUI/CUI bit correctly regardless of whether we can update the resources.

@swaroop-sridhar
Copy link
Contributor

I expected that this bit should be set properly -- because the SDK's computation of the WindowsGraphicalUserInterface property or the HostModel's setting the GUI/CUI bit is independent of the host (but rather depends on the RID).

So, we need to investigate what went wrong here.

@NicolasDorier
Copy link
Author

NicolasDorier commented Oct 29, 2023

Probably fixed by dotnet/runtime#89303 in 8.0, untested though.

@NicolasDorier
Copy link
Author

Fixed in 8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants