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];
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 "--help":
Usage();
return;
case "-v":
case "--version":
Version();
case "-c":
case "--current":
ColorTable.PrintTable();
return;
case "-l":
case "--location":
SchemeManager.PrintSchemesDirectory();
return;
case "-x":
case "--xterm":
setUnixStyle = true;
setProperties = true;
break;
case "-t":
case "--terminal":
setTerminalStyle = true;
setProperties = true;
break;
case "-o":
case "--output":
if (i + 1 < args.Length)
@ -91,6 +59,38 @@ namespace ColorTool
case "--schemes":
SchemeManager.PrintSchemes();
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:
break;
}
@ -127,7 +127,7 @@ namespace ColorTool
{
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
var info = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
Console.WriteLine($"colortool v{info.FileVersion}");
Console.WriteLine($"ColorTool v{info.FileVersion}");
}
/// <summary>
@ -146,9 +146,9 @@ namespace ColorTool
{
yield return new VirtualTerminalConsoleTarget();
}
else if (setTerminalStyle)
{
yield return new TerminalSchemeConsoleTarget();
else if (setTerminalStyle)
{
yield return new TerminalSchemeConsoleTarget();
}
else
{

View file

@ -1,173 +1,190 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
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
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, 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="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<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>
<comment>This is a comment</comment>
</data>
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
mimetype set.
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
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
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
: 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
: using a System.ComponentModel.TypeConverter
: 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:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<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:sequence>
<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="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="IniLoadError" xml:space="preserve">
<value>Error loading ini file "{0}"</value>
</data>
<data name="IniParseError" xml:space="preserve">
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
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
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, 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="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<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>
<comment>This is a comment</comment>
</data>
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
mimetype set.
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
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
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
: 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
: using a System.ComponentModel.TypeConverter
: 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:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<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:sequence>
<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="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="IniLoadError" xml:space="preserve">
<value>Error loading ini file "{0}"</value>
</data>
<data name="IniParseError" xml:space="preserve">
<value>Error loading ini file "{0}"
for key "{1}"
the value "{2}" is invalid</value>
</data>
<data name="InvalidColor" xml:space="preserve">
<value>Invalid Color</value>
</data>
<data name="InvalidNumberOfColors" xml:space="preserve">
<value>Invalid scheme - did not find 16 colors</value>
</data>
<data name="OutputUsage" xml:space="preserve">
<value>Usage: colortool -o &lt;filename&gt;</value>
</data>
<data name="SchemeNotFound" xml:space="preserve">
<value>Could not find or load "{0}"</value>
</data>
<data name="Usage" xml:space="preserve">
<value>Usage:
colortool.exe [options] &lt;schemename&gt;
ColorTool is a utility for helping to set the color palette of the Windows Console.
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".
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.
Arguments:
&lt;schemename&gt;: The name of a color scheme. ct 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.
Options:
-?, --help : Display this help message
-c, --current : Print the color table for the currently applied scheme
-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
-b, --both : Apply the scheme to both the current console and the defaults.
-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.
-s, --schemes : Displays all available schemes
-l, --location : Displays the full path to the schemes directory
-v, --version : Display the version number
-o, --output &lt;filename&gt; : output the current color table to a file (in .ini format)
Available importers:
{0}</value>
</data>
<data name="WroteToDefaults" xml:space="preserve">
<value>Wrote selected scheme to the defaults.</value>
</data>
</root>
the value "{2}" is invalid</value>
</data>
<data name="InvalidColor" xml:space="preserve">
<value>Invalid Color</value>
</data>
<data name="InvalidNumberOfColors" xml:space="preserve">
<value>Invalid scheme - did not find 16 colors</value>
</data>
<data name="OutputUsage" xml:space="preserve">
<value>Usage: colortool -o &lt;filename&gt;</value>
</data>
<data name="SchemeNotFound" xml:space="preserve">
<value>Could not find or load "{0}"</value>
</data>
<data name="Usage" xml:space="preserve">
<value>Usage:
ColorTool.exe &lt;Function&gt;
ColorTool.exe [Options] &lt;Scheme name&gt;
ColorTool is a utility for helping to set the color palette of the Windows Console.
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".
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.
Parameters:
&lt;Function&gt; : One and only one of the switches listed in the "Functions" section below.
&lt;Scheme name&gt;: 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
-c, --current : Print the color table for the currently applied scheme
-v, --version : Display the version number
-l, --location : Displays the full path to the schemes directory
-s, --schemes : Displays all available schemes
-o, --output &lt;filename&gt; : 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 &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!
```
```plain
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.
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".
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.
Arguments:
<schemename>: The name of a color scheme. ct will try to first load it as an .itermcolors color scheme.
If that fails, it will look for it as an .ini file color scheme.
Options:
Parameters:
<Function> : One and only one of the switches listed in the "Functions" section below.
<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
-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
-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 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
* `campbell` is the new default scheme used by the Windows Console Host, as of the Fall Creator's Update.
* `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.
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
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.
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.
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.
## 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
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
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"
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" (
set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
set AppFiles=%ProgramFiles(x86)%
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
)
if exist "%ProgramFiles%\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"
set MSBUILD="%AppFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
if exist %MSBUILD% (
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles(x86)%\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"
set MSBUILD="%AppFiles%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe"
if exist %MSBUILD% (
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" (
set MSBUILD="%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"
if exist %MSBUILD% (
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" (
set MSBUILD="%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"
if exist %MSBUILD% (
goto :FOUND_MSBUILD
)
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" (
set MSBUILD="%ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe"
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"
set MSBUILD="%AppFiles%\MSBuild\14.0\bin\msbuild.exe"
if exist %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
echo MSBuild was found at %MSBUILD%
echo.
set _MSBUILD_TARGET=Build
set _MSBUILD_CONFIG=Debug
@ -63,17 +54,17 @@ shift
goto :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) (
echo.
echo Created exe in:
echo %~dp0ColorTool\bin\%_MSBUILD_CONFIG%\colortool.exe
echo %~dp0ColorTool\bin\%_MSBUILD_CONFIG%\ColorTool.exe
echo.
echo Copying exe to root of project...
copy %~dp0ColorTool\bin\%_MSBUILD_CONFIG%\colortool.exe %~dp0colortool.exe
echo Done.
copy %~dp0ColorTool\bin\%_MSBUILD_CONFIG%\colortool.exe %~dp0ColorTool.exe
echo.
)
:EXIT
:EXIT
Pause