ColorTool: Proofread the helper text, update Build.bat (#2644)

First, my changes to `build.bat`:

1. `Build.bat` now looks for Visual Studio 2019 too.
2. `Build.bat` now ensures that the linker places ColorTool.exe into
   `\debug` or `\release` folders, not `\debug\net471` or
   `\release\net471`.
3. `Build.bat` is now smarter in its search. It determines the operating
   system's CPU architecture before deciding whether to search in "Program
   Files (x86)" or "Program Files".

Second, my changes to the help text displayed to the user:

1. The help text now makes it clear that some switches cannot be used
   with certain others.
2. Some typos are fixed. e.g. "ct" to "ColorTool" (it took me two hours
   to figure this one out!) and "schemename" to "scheme name".

I've made a minor change to the order of `switch (arg)` in Program.cs
too, to ensure that the terminating switches are analyzed first. This
way, there will be fewer surprises if the user supplies malformed input.
But feel free to reject this one.

# Unresolved issues

`Build.bat` is inherently faulty. On a pristine computer, a user cannot
just install the latest version of Microsoft Build Tool and run
`build.bat` to build ColorTool. The reason is the absence of certain
NuGet packages. Either NuGet or Visual Studio must download the
dependencies first.

# Validation Steps Performed

Since the changes to the code are minor, I don't know what test I can
possibly devise, other than compiling it and seeing that it works.
This commit is contained in:
skycommand 2019-12-04 00:14:23 +03:30 committed by Dustin L. Howett (MSFT)
parent 72761fceab
commit 5585183d7d
4 changed files with 299 additions and 268 deletions

View File

@ -32,50 +32,18 @@ namespace ColorTool
string arg = args[i]; string arg = args[i];
switch (arg) switch (arg)
{ {
case "-c":
case "--current":
ColorTable.PrintTable();
return;
case "-e":
case "--errors":
reportErrors = true;
break;
case "-q":
case "--quiet":
quietMode = true;
break;
case "-d":
case "--defaults":
setDefaults = true;
setProperties = false;
break;
case "-b":
case "--both":
setDefaults = true;
setProperties = true;
break;
case "-?": case "-?":
case "--help": case "--help":
Usage(); Usage();
return; return;
case "-v": case "-c":
case "--version": case "--current":
Version(); ColorTable.PrintTable();
return; return;
case "-l": case "-l":
case "--location": case "--location":
SchemeManager.PrintSchemesDirectory(); SchemeManager.PrintSchemesDirectory();
return; return;
case "-x":
case "--xterm":
setUnixStyle = true;
setProperties = true;
break;
case "-t":
case "--terminal":
setTerminalStyle = true;
setProperties = true;
break;
case "-o": case "-o":
case "--output": case "--output":
if (i + 1 < args.Length) if (i + 1 < args.Length)
@ -91,6 +59,38 @@ namespace ColorTool
case "--schemes": case "--schemes":
SchemeManager.PrintSchemes(); SchemeManager.PrintSchemes();
return; return;
case "-v":
case "--version":
Version();
return;
case "-e":
case "--errors":
reportErrors = true;
break;
case "-q":
case "--quiet":
quietMode = true;
break;
case "-d":
case "--defaults":
setDefaults = true;
setProperties = false;
break;
case "-b":
case "--both":
setDefaults = true;
setProperties = true;
break;
case "-x":
case "--xterm":
setUnixStyle = true;
setProperties = true;
break;
case "-t":
case "--terminal":
setTerminalStyle = true;
setProperties = true;
break;
default: default:
break; break;
} }
@ -127,7 +127,7 @@ namespace ColorTool
{ {
var assembly = System.Reflection.Assembly.GetExecutingAssembly(); var assembly = System.Reflection.Assembly.GetExecutingAssembly();
var info = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location); var info = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
Console.WriteLine($"colortool v{info.FileVersion}"); Console.WriteLine($"ColorTool v{info.FileVersion}");
} }
/// <summary> /// <summary>
@ -146,9 +146,9 @@ namespace ColorTool
{ {
yield return new VirtualTerminalConsoleTarget(); yield return new VirtualTerminalConsoleTarget();
} }
else if (setTerminalStyle) else if (setTerminalStyle)
{ {
yield return new TerminalSchemeConsoleTarget(); yield return new TerminalSchemeConsoleTarget();
} }
else else
{ {

View File

@ -1,173 +1,190 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 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 : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 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 : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 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 : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata"> <xsd:element name="metadata">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" /> <xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" /> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="assembly"> <xsd:element name="assembly">
<xsd:complexType> <xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" /> <xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="data"> <xsd:element name="data">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" /> <xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="resheader"> <xsd:element name="resheader">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" /> <xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:choice> </xsd:choice>
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
</xsd:schema> </xsd:schema>
<resheader name="resmimetype"> <resheader name="resmimetype">
<value>text/microsoft-resx</value> <value>text/microsoft-resx</value>
</resheader> </resheader>
<resheader name="version"> <resheader name="version">
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="IniLoadError" xml:space="preserve"> <data name="IniLoadError" xml:space="preserve">
<value>Error loading ini file "{0}"</value> <value>Error loading ini file "{0}"</value>
</data> </data>
<data name="IniParseError" xml:space="preserve"> <data name="IniParseError" xml:space="preserve">
<value>Error loading ini file "{0}" <value>Error loading ini file "{0}"
for key "{1}" for key "{1}"
the value "{2}" is invalid</value> the value "{2}" is invalid</value>
</data> </data>
<data name="InvalidColor" xml:space="preserve"> <data name="InvalidColor" xml:space="preserve">
<value>Invalid Color</value> <value>Invalid Color</value>
</data> </data>
<data name="InvalidNumberOfColors" xml:space="preserve"> <data name="InvalidNumberOfColors" xml:space="preserve">
<value>Invalid scheme - did not find 16 colors</value> <value>Invalid scheme - did not find 16 colors</value>
</data> </data>
<data name="OutputUsage" xml:space="preserve"> <data name="OutputUsage" xml:space="preserve">
<value>Usage: colortool -o &lt;filename&gt;</value> <value>Usage: colortool -o &lt;filename&gt;</value>
</data> </data>
<data name="SchemeNotFound" xml:space="preserve"> <data name="SchemeNotFound" xml:space="preserve">
<value>Could not find or load "{0}"</value> <value>Could not find or load "{0}"</value>
</data> </data>
<data name="Usage" xml:space="preserve"> <data name="Usage" xml:space="preserve">
<value>Usage: <value>Usage:
colortool.exe [options] &lt;schemename&gt; ColorTool.exe &lt;Function&gt;
ColorTool is a utility for helping to set the color palette of the Windows Console. ColorTool.exe [Options] &lt;Scheme name&gt;
By default, applies the colors in the specified .itermcolors, .json or .ini file to the current console window.
This does NOT save the properties automatically. For that, you'll need to open the properties sheet and hit "Ok". ColorTool is a utility for helping to set the color palette of the Windows Console.
Included should be a `schemes/` directory with a selection of schemes of both formats for examples. By default, applies the colors in the specified .itermcolors, .json or .ini file to the current console window.
Feel free to add your own preferred scheme to that directory. This does NOT save the properties automatically. For that, you'll need to open the properties sheet and hit "Ok".
Arguments: Included should be a `schemes/` directory with a selection of schemes of both formats for examples.
&lt;schemename&gt;: The name of a color scheme. ct will try to first load it as an .ini file color scheme Feel free to add your own preferred scheme to that directory.
If that fails, it will look for it as a .json file color scheme
If that fails, it will look for it as an .itermcolors file color scheme. Parameters:
Options: &lt;Function&gt; : One and only one of the switches listed in the "Functions" section below.
-?, --help : Display this help message &lt;Scheme name&gt;: The name of a color scheme. ColorTool will try to first load it as an .ini file color scheme
-c, --current : Print the color table for the currently applied scheme If that fails, it will look for it as a .json file color scheme
-q, --quiet : Don't print the color table after applying If that fails, it will look for it as an .itermcolors file color scheme.
-e, --errors : Report scheme parsing errors on the console Must be the last parameter passed to ColorTool.
-d, --defaults : Apply the scheme to only the defaults in the registry [Option] : One or more of the switches listed in the "Options" section below. Must appear before scheme
-b, --both : Apply the scheme to both the current console and the defaults. name.
-x, --xterm : Set the colors using VT sequences. Used for setting the colors in WSL.
Only works in Windows versions &gt;= 17048. Functions:
-t, --terminal : Output the colors in JSON format for copying into a Windows Terminal settings file. You may specify only one of the following switches each time you invoke ColorTool. Any additional switches
-s, --schemes : Displays all available schemes before or after the first one of them will be ignored.
-l, --location : Displays the full path to the schemes directory
-v, --version : Display the version number -?, --help : Display this help message
-o, --output &lt;filename&gt; : output the current color table to a file (in .ini format) -c, --current : Print the color table for the currently applied scheme
-v, --version : Display the version number
Available importers: -l, --location : Displays the full path to the schemes directory
{0}</value> -s, --schemes : Displays all available schemes
</data> -o, --output &lt;filename&gt; : output the current color table to a file in .ini format
<data name="WroteToDefaults" xml:space="preserve">
<value>Wrote selected scheme to the defaults.</value> Options:
</data> You may use these switches before a scheme name.
</root>
-q, --quiet : Don't print the color table after applying
-e, --errors : Report scheme parsing errors on the console
-d, --defaults : Apply the scheme to only the defaults in the registry
By default, the scheme would be applied to the current console instead.
-b, --both : Apply the scheme to both the current console and the defaults.
By default, the scheme would be applied to the current console only.
-x, --xterm : Set the colors using VT sequences. Used for setting the colors in WSL.
Only works in Windows versions &gt;= 17048.
-t, --terminal : Output the colors in JSON format for copying into a Windows Terminal settings file.
Available importers:
{0}</value>
</data>
<data name="WroteToDefaults" xml:space="preserve">
<value>Wrote selected scheme to the defaults.</value>
</data>
</root>

View File

@ -1,54 +1,77 @@
# ColorTool # ColorTool
ColorTool makes it easy to change the Windows console to your desired scheme. Includes support for iTerm themes! ColorTool makes it easy to change the Windows console to your desired scheme. Includes support for iTerm themes!
``` ```plain
Usage: Usage:
colortool.exe [options] <schemename> ColorTool.exe <Function>
ColorTool.exe [Options] <Scheme name>
ColorTool is a utility for helping to set the color palette of the Windows Console. ColorTool is a utility for helping to set the color palette of the Windows Console.
By default, applies the colors in the specified .itermcolors or .ini file to the current console window. By default, applies the colors in the specified .itermcolors, .json or .ini file to the current console window.
This does NOT save the properties automatically. For that, you'll need to open the properties sheet and hit "Ok". This does NOT save the properties automatically. For that, you'll need to open the properties sheet and hit "Ok".
Included should be a `schemes/` directory with a selection of schemes of both formats for examples. Included should be a `schemes/` directory with a selection of schemes of both formats for examples.
Feel free to add your own preferred scheme to that directory. Feel free to add your own preferred scheme to that directory.
Arguments:
<schemename>: The name of a color scheme. ct will try to first load it as an .itermcolors color scheme. Parameters:
If that fails, it will look for it as an .ini file color scheme. <Function> : One and only one of the switches listed in the "Functions" section below.
Options: <Scheme name>: The name of a color scheme. ColorTool will try to first load it as an .ini file color scheme
If that fails, it will look for it as a .json file color scheme
If that fails, it will look for it as an .itermcolors file color scheme.
Must be the last parameter passed to ColorTool.
[Option] : One or more of the switches listed in the "Options" section below. Must appear before scheme
name.
Functions:
You may specify only one of the following switches each time you invoke ColorTool. Any additional switches
before or after the first one of them will be ignored.
-?, --help : Display this help message -?, --help : Display this help message
-c, --current : Print the color table for the currently applied scheme -c, --current : Print the color table for the currently applied scheme
-q, --quiet : Don't print the color table after applying
-d, --defaults : Apply the scheme to only the defaults in the registry
-b, --both : Apply the scheme to both the current console and the defaults.
-s, --schemes : Display all available schemes
-v, --version : Display the version number -v, --version : Display the version number
-l, --location : Displays the full path to the schemes directory
-s, --schemes : Displays all available schemes
-o, --output <filename> : output the current color table to a file in .ini format
Options:
You may use these switches before a scheme name.
-q, --quiet : Don't print the color table after applying
-e, --errors : Report scheme parsing errors on the console
-d, --defaults : Apply the scheme to only the defaults in the registry
By default, the scheme would be applied to the current console instead.
-b, --both : Apply the scheme to both the current console and the defaults.
By default, the scheme would be applied to the current console only.
-x, --xterm : Set the colors using VT sequences. Used for setting the colors in WSL.
Only works in Windows versions >= 17048.
-t, --terminal : Output the colors in JSON format for copying into a Windows Terminal settings file.
``` ```
## Included Schemes ## Included Schemes
Included are two important color schemes in .ini file format - `cmd-legacy` and `campbell`. Included are two important color schemes in .ini file format: `cmd-legacy` and `campbell`.
* `cmd-legacy` is the legacy color scheme of the Windows Console, before July 2017 * `cmd-legacy` is the legacy color scheme of the Windows Console, before July 2017
* `campbell` is the new default scheme used by the Windows Console Host, as of the Fall Creator's Update.
* `campbell` is the new default scheme used by the Windows Console Host, as of the Fall Creator's Update.
There are a few other schemes in that directory in both .ini format and .itermcolors. There are a few other schemes in that directory in both .ini format and .itermcolors.
## Adding Schemes ## Adding Schemes
You can also add color schemes to the colortool easily. Take any existing scheme in `.itermcolors` format, and paste it in the `schemes/` directory. Or just cd into a directory containing `*.itermcolors` files before running the colortool. You can also add color schemes to the ColorTool easily. Take any existing scheme in `.itermcolors` format, and paste it in the `schemes/` directory. Or just cd into a directory containing `*.itermcolors` files before running the ColorTool.
I recommend the excellent [iTerm2-Color-Schemes](https://github.com/mbadolato/iTerm2-Color-Schemes) repo, which has TONS of schemes to choose from, and previews. I recommend the excellent [iTerm2-Color-Schemes](https://github.com/mbadolato/iTerm2-Color-Schemes) repo, which has TONS of schemes to choose from, and previews.
You can also easily visually edit `.itermcolors` color schemes using [terminal.sexy](https://terminal.sexy). Use the **Import** and **Export** tabs with `iTerm2` as the format.
## Installing You can also easily visually edit `.itermcolors` color schemes using [terminal.sexy](https://terminal.sexy). Use the **Import** and **Export** tabs with `iTerm2` as the format.
Just [download the latest colortool release](https://github.com/microsoft/terminal/releases/tag/1904.29002) and extract the zip file. ## Installing
Just [download the latest ColorTool release](https://github.com/microsoft/terminal/releases/tag/1904.29002) and extract the zip file.
## Building ## Building
Either build with Visual Studio, or use the included `build.bat` from the command line to try and auto-detect your msbuild version. Either build with Visual Studio, or use the included `build.bat` from the command line to try and auto-detect your MSBuild version.
## Contributing ## Contributing
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

View File

@ -6,48 +6,39 @@ for /f "usebackq tokens=*" %%f in (`where.exe msbuild.exe 2^>nul`) do (
set MSBUILD="%%~ff" set MSBUILD="%%~ff"
goto :FOUND_MSBUILD goto :FOUND_MSBUILD
) )
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" ( set AppFiles=%ProgramFiles(x86)%
set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" if NOT %PROCESSOR_ARCHITECTURE%==AMD64 set AppFiles=%ProgramFiles%
set MSBUILD="%AppFiles%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
if exist %MSBUILD% (
goto :FOUND_MSBUILD goto :FOUND_MSBUILD
) )
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" ( set MSBUILD="%AppFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
set MSBUILD="%ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" if exist %MSBUILD% (
goto :FOUND_MSBUILD goto :FOUND_MSBUILD
) )
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" ( set MSBUILD="%AppFiles%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe"
set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" if exist %MSBUILD% (
goto :FOUND_MSBUILD goto :FOUND_MSBUILD
) )
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" ( set MSBUILD="%AppFiles%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe"
set MSBUILD="%ProgramFiles%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" if exist %MSBUILD% (
goto :FOUND_MSBUILD goto :FOUND_MSBUILD
) )
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" ( set MSBUILD="%AppFiles%\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe"
set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" if exist %MSBUILD% (
goto :FOUND_MSBUILD goto :FOUND_MSBUILD
) )
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" ( set MSBUILD="%AppFiles%\MSBuild\14.0\bin\msbuild.exe"
set MSBUILD="%ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" if exist %MSBUILD% (
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe" (
set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe"
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles(x86)%\MSBuild\14.0\bin" (
set MSBUILD="%ProgramFiles(x86)%\MSBuild\14.0\bin\msbuild.exe"
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles%\MSBuild\14.0\bin" (
set MSBUILD="%ProgramFiles%\MSBuild\14.0\bin\msbuild.exe"
goto :FOUND_MSBUILD goto :FOUND_MSBUILD
) )
echo "MSBuild was not found. Make sure it is installed and included in the search path."
goto :EXIT
if %MSBUILD%==() (
echo "I couldn't find MSBuild on your PC. Make sure it's installed somewhere, and if it's not in the above if statements (in build.bat), add it."
goto :EXIT
)
:FOUND_MSBUILD :FOUND_MSBUILD
echo MSBuild was found at %MSBUILD%
echo.
set _MSBUILD_TARGET=Build set _MSBUILD_TARGET=Build
set _MSBUILD_CONFIG=Debug set _MSBUILD_CONFIG=Debug
@ -63,17 +54,17 @@ shift
goto :ARGS_LOOP goto :ARGS_LOOP
:POST_ARGS_LOOP :POST_ARGS_LOOP
%MSBUILD% %~dp0ColorTool.sln /t:%_MSBUILD_TARGET% /m /nr:true /p:Configuration=%_MSBUILD_CONFIG% %MSBUILD% %~dp0ColorTool.sln /t:%_MSBUILD_TARGET% /m /nr:true /p:Configuration=%_MSBUILD_CONFIG% /p:OutputPath=.\bin\%_MSBUILD_CONFIG%\
if (%ERRORLEVEL%) == (0) ( if (%ERRORLEVEL%) == (0) (
echo. echo.
echo Created exe in: echo Created exe in:
echo %~dp0ColorTool\bin\%_MSBUILD_CONFIG%\colortool.exe echo %~dp0ColorTool\bin\%_MSBUILD_CONFIG%\ColorTool.exe
echo. echo.
echo Copying exe to root of project... echo Copying exe to root of project...
copy %~dp0ColorTool\bin\%_MSBUILD_CONFIG%\colortool.exe %~dp0colortool.exe copy %~dp0ColorTool\bin\%_MSBUILD_CONFIG%\colortool.exe %~dp0ColorTool.exe
echo Done.
echo. echo.
) )
:EXIT :EXIT
Pause