-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
EnableWindowsTargeting does not work well for building WinApps in linux #34197
Comments
@marcpopMSFT who can help with this issue? |
I have the same issue on .NET 6.0.
|
Adding @dsplaisted who did that feature. I think the extra window comes from the apptype being winexe though I'm not sure why it would behave differently when built on windows versus linux. |
I think this could be a side effect of: dotnet/runtime#3828 |
That's correct. Currently For actually producing the app that will be shipped, you still should generally do that from a Windows OS. Fixing dotnet/runtime#3828 would be a good step, but even if we do that there might be other issues that prevent the output from a non-Windows build from being the same as when building on Windows. |
I am not sure whether the original intention of this design is to allow users to compile programs for windows on different platforms. Judging from the problems reported by NETSDK1100, it seems to be so. I think, if .net team can't make .net Windows program run cross-platform, but at least please make it cross-platform compiling, so that developers can easily use linux CI/CD to build release applications. |
The docs at https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#enablewindowstargeting state this: Set the EnableWindowsTargeting property to true to build Windows apps (for example, Windows Forms or Windows Presentation Foundation apps) on a non-Windows platform. If you don't set this property to true, you'll get build warning NETSDK1100. This error occurs because targeting and runtime packs aren't automatically downloaded on platforms that aren't supported. By setting this property, those packs are downloaded when cross-targeting. We could correct the docs into "to test the buildability of Windows apps... on a non-Windows platform". |
@tdykstra Per the discussion here, it would be good to update the docs for EnableWindowsTargeting to include something like this:
|
Note that this needs to be revisited after: |
Hi Team,
I am trying to build and publish my WPF(.net7-windows) through the github action pipeline. After reading this blog, I find EnableWindowsTargeting can be used for build Windows App on a linux machine.
However, after publishing the app in ubuntu-latest runner and run it, I find there is a unwanted console output window after my app is lauching. It does not act like the building artifact from windows machine.
I also tried publish the app on ther linux machines and found the same behavior. The console output window is annoying.
You can also see this issue in this blog.
Please kindly let me know if there is any other properties need to combine with EnableWindowsTargeting for building a WPF app in linux, or it is a bug?
BTW, the windows runner for github action is really slow, and expensive, comparing to ubuntu runner. :(
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
EnableWindowsTargeting
property to true - .NET CLIAssociated WorkItem - 69434
The text was updated successfully, but these errors were encountered: