Skip to content

Commit

Permalink
Add ability to mark self-contained .exe as Windows GUI program. (#2470)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
vitek-karas authored Aug 21, 2018
1 parent 8af38bc commit 1b17e16
Show file tree
Hide file tree
Showing 20 changed files with 561 additions and 18 deletions.
8 changes: 8 additions & 0 deletions src/Tasks/Common/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -401,4 +401,12 @@ The following are names of parameters or literal values and should not be transl
<value>NETSDK1070: The application configuration file must have root configuration element.</value>
<comment>{StrBegin="NETSDK1070: "}</comment>
</data>
<data name="AppHostNotWindows" xml:space="preserve">
<value>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</value>
<comment>{StrBegin="NETSDK1071: "}</comment>
</data>
<data name="AppHostNotWindowsCLI" xml:space="preserve">
<value>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</value>
<comment>{StrBegin="NETSDK1072: "}</comment>
</data>
</root>
10 changes: 10 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<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">
<file datatype="xml" source-language="en" target-language="cs" original="../Strings.resx">
<body>
<trans-unit id="AppHostNotWindows">
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
<note>{StrBegin="NETSDK1071: "}</note>
</trans-unit>
<trans-unit id="AppHostNotWindowsCLI">
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
<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>
<note>{StrBegin="NETSDK1072: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>
Expand Down
10 changes: 10 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<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">
<file datatype="xml" source-language="en" target-language="de" original="../Strings.resx">
<body>
<trans-unit id="AppHostNotWindows">
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
<note>{StrBegin="NETSDK1071: "}</note>
</trans-unit>
<trans-unit id="AppHostNotWindowsCLI">
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
<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>
<note>{StrBegin="NETSDK1072: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>
Expand Down
10 changes: 10 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<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">
<file datatype="xml" source-language="en" target-language="es" original="../Strings.resx">
<body>
<trans-unit id="AppHostNotWindows">
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
<note>{StrBegin="NETSDK1071: "}</note>
</trans-unit>
<trans-unit id="AppHostNotWindowsCLI">
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
<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>
<note>{StrBegin="NETSDK1072: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>
Expand Down
10 changes: 10 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<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">
<file datatype="xml" source-language="en" target-language="fr" original="../Strings.resx">
<body>
<trans-unit id="AppHostNotWindows">
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
<note>{StrBegin="NETSDK1071: "}</note>
</trans-unit>
<trans-unit id="AppHostNotWindowsCLI">
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
<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>
<note>{StrBegin="NETSDK1072: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>
Expand Down
10 changes: 10 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<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">
<file datatype="xml" source-language="en" target-language="it" original="../Strings.resx">
<body>
<trans-unit id="AppHostNotWindows">
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
<note>{StrBegin="NETSDK1071: "}</note>
</trans-unit>
<trans-unit id="AppHostNotWindowsCLI">
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
<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>
<note>{StrBegin="NETSDK1072: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>
Expand Down
10 changes: 10 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.ja.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<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">
<file datatype="xml" source-language="en" target-language="ja" original="../Strings.resx">
<body>
<trans-unit id="AppHostNotWindows">
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
<note>{StrBegin="NETSDK1071: "}</note>
</trans-unit>
<trans-unit id="AppHostNotWindowsCLI">
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
<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>
<note>{StrBegin="NETSDK1072: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>
Expand Down
10 changes: 10 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.ko.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<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">
<file datatype="xml" source-language="en" target-language="ko" original="../Strings.resx">
<body>
<trans-unit id="AppHostNotWindows">
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
<note>{StrBegin="NETSDK1071: "}</note>
</trans-unit>
<trans-unit id="AppHostNotWindowsCLI">
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
<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>
<note>{StrBegin="NETSDK1072: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>
Expand Down
10 changes: 10 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.pl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<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">
<file datatype="xml" source-language="en" target-language="pl" original="../Strings.resx">
<body>
<trans-unit id="AppHostNotWindows">
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
<note>{StrBegin="NETSDK1071: "}</note>
</trans-unit>
<trans-unit id="AppHostNotWindowsCLI">
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
<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>
<note>{StrBegin="NETSDK1072: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>
Expand Down
10 changes: 10 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<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">
<file datatype="xml" source-language="en" target-language="pt-BR" original="../Strings.resx">
<body>
<trans-unit id="AppHostNotWindows">
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
<note>{StrBegin="NETSDK1071: "}</note>
</trans-unit>
<trans-unit id="AppHostNotWindowsCLI">
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
<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>
<note>{StrBegin="NETSDK1072: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>
Expand Down
10 changes: 10 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.ru.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<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">
<file datatype="xml" source-language="en" target-language="ru" original="../Strings.resx">
<body>
<trans-unit id="AppHostNotWindows">
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
<note>{StrBegin="NETSDK1071: "}</note>
</trans-unit>
<trans-unit id="AppHostNotWindowsCLI">
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
<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>
<note>{StrBegin="NETSDK1072: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>
Expand Down
10 changes: 10 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.tr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<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">
<file datatype="xml" source-language="en" target-language="tr" original="../Strings.resx">
<body>
<trans-unit id="AppHostNotWindows">
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
<note>{StrBegin="NETSDK1071: "}</note>
</trans-unit>
<trans-unit id="AppHostNotWindowsCLI">
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
<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>
<note>{StrBegin="NETSDK1072: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>
Expand Down
10 changes: 10 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<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">
<file datatype="xml" source-language="en" target-language="zh-Hans" original="../Strings.resx">
<body>
<trans-unit id="AppHostNotWindows">
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
<note>{StrBegin="NETSDK1071: "}</note>
</trans-unit>
<trans-unit id="AppHostNotWindowsCLI">
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
<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>
<note>{StrBegin="NETSDK1072: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>
Expand Down
10 changes: 10 additions & 0 deletions src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<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">
<file datatype="xml" source-language="en" target-language="zh-Hant" original="../Strings.resx">
<body>
<trans-unit id="AppHostNotWindows">
<source>NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</source>
<target state="new">NETSDK1071: Unable to use '{0}' as application host executable because it's not a Windows PE file.</target>
<note>{StrBegin="NETSDK1071: "}</note>
</trans-unit>
<trans-unit id="AppHostNotWindowsCLI">
<source>NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem.</source>
<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>
<note>{StrBegin="NETSDK1072: "}</note>
</trans-unit>
<trans-unit id="AppConfigRequiresRootConfiguration">
<source>NETSDK1070: The application configuration file must have root configuration element.</source>
<target state="new">NETSDK1070: The application configuration file must have root configuration element.</target>
Expand Down
Loading

0 comments on commit 1b17e16

Please sign in to comment.