Skip to content

Commit 1b17e16

Browse files
authored
Add ability to mark self-contained .exe as Windows GUI program. (#2470)
* Add ability to mark self-contained .exe as Windows GUI program. On Windows only, if the OutputType of the project is WinExe (as oppose to just exe), self-contained published app will now have its subsystem set to Windows GUI. This means the app will start without a console. The change renames the task EmbedAppNameInHost to CreateAppHost as it now does more than just embedding the path to the app. Added unit tests for the AppHost class and then an E2E for the publish command.
1 parent 8af38bc commit 1b17e16

File tree

20 files changed

+561
-18
lines changed

20 files changed

+561
-18
lines changed

src/Tasks/Common/Resources/Strings.resx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,4 +401,12 @@ The following are names of parameters or literal values and should not be transl
401401
<value>NETSDK1070: The application configuration file must have root configuration element.</value>
402402
<comment>{StrBegin="NETSDK1070: "}</comment>
403403
</data>
404+
<data name="AppHostNotWindows" xml:space="preserve">
405+
<value>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</value>
406+
<comment>{StrBegin="NETSDK1071: "}</comment>
407+
</data>
408+
<data name="AppHostNotWindowsCLI" xml:space="preserve">
409+
<value>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</value>
410+
<comment>{StrBegin="NETSDK1072: "}</comment>
411+
</data>
404412
</root>

src/Tasks/Common/Resources/xlf/Strings.cs.xlf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
33
<file datatype="xml" source-language="en" target-language="cs" original="../Strings.resx">
44
<body>
5+
<trans-unit id="AppHostNotWindows">
6+
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
7+
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
8+
<note>{StrBegin="NETSDK1071: "}</note>
9+
</trans-unit>
10+
<trans-unit id="AppHostNotWindowsCLI">
11+
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
12+
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</target>
13+
<note>{StrBegin="NETSDK1072: "}</note>
14+
</trans-unit>
515
<trans-unit id="AppConfigRequiresRootConfiguration">
616
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
717
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>

src/Tasks/Common/Resources/xlf/Strings.de.xlf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
33
<file datatype="xml" source-language="en" target-language="de" original="../Strings.resx">
44
<body>
5+
<trans-unit id="AppHostNotWindows">
6+
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
7+
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
8+
<note>{StrBegin="NETSDK1071: "}</note>
9+
</trans-unit>
10+
<trans-unit id="AppHostNotWindowsCLI">
11+
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
12+
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</target>
13+
<note>{StrBegin="NETSDK1072: "}</note>
14+
</trans-unit>
515
<trans-unit id="AppConfigRequiresRootConfiguration">
616
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
717
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>

src/Tasks/Common/Resources/xlf/Strings.es.xlf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
33
<file datatype="xml" source-language="en" target-language="es" original="../Strings.resx">
44
<body>
5+
<trans-unit id="AppHostNotWindows">
6+
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
7+
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
8+
<note>{StrBegin="NETSDK1071: "}</note>
9+
</trans-unit>
10+
<trans-unit id="AppHostNotWindowsCLI">
11+
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
12+
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</target>
13+
<note>{StrBegin="NETSDK1072: "}</note>
14+
</trans-unit>
515
<trans-unit id="AppConfigRequiresRootConfiguration">
616
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
717
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>

src/Tasks/Common/Resources/xlf/Strings.fr.xlf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
33
<file datatype="xml" source-language="en" target-language="fr" original="../Strings.resx">
44
<body>
5+
<trans-unit id="AppHostNotWindows">
6+
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
7+
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
8+
<note>{StrBegin="NETSDK1071: "}</note>
9+
</trans-unit>
10+
<trans-unit id="AppHostNotWindowsCLI">
11+
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
12+
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</target>
13+
<note>{StrBegin="NETSDK1072: "}</note>
14+
</trans-unit>
515
<trans-unit id="AppConfigRequiresRootConfiguration">
616
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
717
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>

src/Tasks/Common/Resources/xlf/Strings.it.xlf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
33
<file datatype="xml" source-language="en" target-language="it" original="../Strings.resx">
44
<body>
5+
<trans-unit id="AppHostNotWindows">
6+
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
7+
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
8+
<note>{StrBegin="NETSDK1071: "}</note>
9+
</trans-unit>
10+
<trans-unit id="AppHostNotWindowsCLI">
11+
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
12+
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</target>
13+
<note>{StrBegin="NETSDK1072: "}</note>
14+
</trans-unit>
515
<trans-unit id="AppConfigRequiresRootConfiguration">
616
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
717
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>

src/Tasks/Common/Resources/xlf/Strings.ja.xlf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
33
<file datatype="xml" source-language="en" target-language="ja" original="../Strings.resx">
44
<body>
5+
<trans-unit id="AppHostNotWindows">
6+
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
7+
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
8+
<note>{StrBegin="NETSDK1071: "}</note>
9+
</trans-unit>
10+
<trans-unit id="AppHostNotWindowsCLI">
11+
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
12+
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</target>
13+
<note>{StrBegin="NETSDK1072: "}</note>
14+
</trans-unit>
515
<trans-unit id="AppConfigRequiresRootConfiguration">
616
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
717
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>

src/Tasks/Common/Resources/xlf/Strings.ko.xlf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
33
<file datatype="xml" source-language="en" target-language="ko" original="../Strings.resx">
44
<body>
5+
<trans-unit id="AppHostNotWindows">
6+
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
7+
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
8+
<note>{StrBegin="NETSDK1071: "}</note>
9+
</trans-unit>
10+
<trans-unit id="AppHostNotWindowsCLI">
11+
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
12+
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</target>
13+
<note>{StrBegin="NETSDK1072: "}</note>
14+
</trans-unit>
515
<trans-unit id="AppConfigRequiresRootConfiguration">
616
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
717
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>

src/Tasks/Common/Resources/xlf/Strings.pl.xlf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
33
<file datatype="xml" source-language="en" target-language="pl" original="../Strings.resx">
44
<body>
5+
<trans-unit id="AppHostNotWindows">
6+
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
7+
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
8+
<note>{StrBegin="NETSDK1071: "}</note>
9+
</trans-unit>
10+
<trans-unit id="AppHostNotWindowsCLI">
11+
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
12+
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</target>
13+
<note>{StrBegin="NETSDK1072: "}</note>
14+
</trans-unit>
515
<trans-unit id="AppConfigRequiresRootConfiguration">
616
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
717
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>

src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
33
<file datatype="xml" source-language="en" target-language="pt-BR" original="../Strings.resx">
44
<body>
5+
<trans-unit id="AppHostNotWindows">
6+
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
7+
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
8+
<note>{StrBegin="NETSDK1071: "}</note>
9+
</trans-unit>
10+
<trans-unit id="AppHostNotWindowsCLI">
11+
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
12+
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</target>
13+
<note>{StrBegin="NETSDK1072: "}</note>
14+
</trans-unit>
515
<trans-unit id="AppConfigRequiresRootConfiguration">
616
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
717
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>

0 commit comments

Comments
 (0)