Skip to content

Commit

Permalink
Add ability to mark self-contained .exe as Windows GUI program.
Browse files Browse the repository at this point in the history
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 PrepareAppHost 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 committed Aug 13, 2018
1 parent 506c69f commit 0370e45
Show file tree
Hide file tree
Showing 19 changed files with 553 additions and 51 deletions.
62 changes: 35 additions & 27 deletions src/Tasks/Common/Resources/Strings.resx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
Expand All @@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
Expand Down 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 teh CUI subsystem.</value>
<comment>{StrBegin="NETSDK1072: "}</comment>
</data>
</root>
12 changes: 11 additions & 1 deletion 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 teh CUI subsystem.</source>
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for teh CUI 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 Expand Up @@ -358,4 +368,4 @@ The following are names of parameters or literal values and should not be transl
</trans-unit>
</body>
</file>
</xliff>
</xliff>
12 changes: 11 additions & 1 deletion 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 teh CUI subsystem.</source>
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for teh CUI 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 Expand Up @@ -358,4 +368,4 @@ The following are names of parameters or literal values and should not be transl
</trans-unit>
</body>
</file>
</xliff>
</xliff>
12 changes: 11 additions & 1 deletion 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 teh CUI subsystem.</source>
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for teh CUI 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 Expand Up @@ -358,4 +368,4 @@ The following are names of parameters or literal values and should not be transl
</trans-unit>
</body>
</file>
</xliff>
</xliff>
12 changes: 11 additions & 1 deletion 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 teh CUI subsystem.</source>
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for teh CUI 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 Expand Up @@ -358,4 +368,4 @@ The following are names of parameters or literal values and should not be transl
</trans-unit>
</body>
</file>
</xliff>
</xliff>
12 changes: 11 additions & 1 deletion 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 teh CUI subsystem.</source>
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for teh CUI 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 Expand Up @@ -358,4 +368,4 @@ The following are names of parameters or literal values and should not be transl
</trans-unit>
</body>
</file>
</xliff>
</xliff>
12 changes: 11 additions & 1 deletion 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 teh CUI subsystem.</source>
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for teh CUI 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 Expand Up @@ -358,4 +368,4 @@ The following are names of parameters or literal values and should not be transl
</trans-unit>
</body>
</file>
</xliff>
</xliff>
12 changes: 11 additions & 1 deletion 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 teh CUI subsystem.</source>
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for teh CUI 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 Expand Up @@ -358,4 +368,4 @@ The following are names of parameters or literal values and should not be transl
</trans-unit>
</body>
</file>
</xliff>
</xliff>
12 changes: 11 additions & 1 deletion 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 teh CUI subsystem.</source>
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for teh CUI 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 Expand Up @@ -358,4 +368,4 @@ The following are names of parameters or literal values and should not be transl
</trans-unit>
</body>
</file>
</xliff>
</xliff>
12 changes: 11 additions & 1 deletion 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 teh CUI subsystem.</source>
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for teh CUI 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 Expand Up @@ -358,4 +368,4 @@ The following are names of parameters or literal values and should not be transl
</trans-unit>
</body>
</file>
</xliff>
</xliff>
12 changes: 11 additions & 1 deletion 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 teh CUI subsystem.</source>
<target state="new">NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for teh CUI 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 Expand Up @@ -358,4 +368,4 @@ The following are names of parameters or literal values and should not be transl
</trans-unit>
</body>
</file>
</xliff>
</xliff>
Loading

0 comments on commit 0370e45

Please sign in to comment.