Home

Awesome

hMSBuild

.bat scripts with full Package Manager inside for searching and wrapping MSBuild tools. All Visual Studio and .NET Framework versions.

You do NOT need powershell or dotnet-cli or local vswhere.exe [?]

Copyright (c) 2017-2024  Denis Kuzmin <x-3F@outlook.com> github/3F

「 ❤ 」 License Build status release GetNuTool

Build history

hMSBuild -only-path -no-vs -notamd64 -no-less-4
hMSBuild -debug ~x ~c Release
hMSBuild -GetNuTool "Conari;regXwild;Fnv1a128"
hMSBuild -GetNuTool vsSolutionBuildEvent/1.16.1:../SDK & SDK\GUI
hMSBuild -cs -no-less-15 /t:Rebuild

Download all editions: Full, Minified, ...

Official Direct Links:

Why hMSBuild

because you need easy access to msbuild tools and more...

Based on GetNuTool and back in those days it was part of it like a small msbuild-helper inside. But finally it was extracted into a new independent project after major changes from MS ecosystem with their products.

Today's hMSBuild provides the most flexible way to access and preparing msbuild tools in different environments. You just specify what you need ... and hMSBuild prepares it for you.

{Screencast - hMSBuild in action. Demo via RunIlAsm error}

Key Features

hMSBuild's algorithm

The basic process is to provide the most suitable instance by explicitly eliminating unnecessary ones.

2.0+

Syntax

Keys to hMSBuild are optional. You can still command like it is official msbuild.exe (MSBuild Tools).

hMSBuild [keys to hMSBuild] [keys to msbuild.exe]

For example,

In order to use package manager,

hMSBuild -GetNuTool keys to it ...

-... or /...

MSBuild Tools supports both key format /... and -...; hMSBuild, in turn, can override some of -...; in this case you need to use /... for example,

"..."

Any value for specific key must be protected inside "..." if contains either whitespaces or delimiters like ; For example:

hmsbuild ~p "Any CPU"

-help

For the most up-to-date information, use hMSBuild -h

hMSBuild 2.4.0
Copyright (c) 2017-2024  Denis Kuzmin <x-3F@outlook.com> github/3F
Copyright (c) hMSBuild contributors https://github.com/3F/hMSBuild

Under the MIT License https://github.com/3F/hMSBuild

Syntax: hMSBuild [keys to hMSBuild] [keys to MSBuild.exe or GetNuTool]

Keys
~~~~
 -no-vs        - Disable searching from Visual Studio.
 -no-netfx     - Disable searching from .NET Framework.
 -no-vswhere   - Do not search via vswhere.
 -no-less-15   - Do not include versions less than 15.0 (install-API/2017+)
 -no-less-4    - Do not include versions less than 4.0 (Windows XP+)

 -priority {IDs} - 15+ Non-strict components preference: C++ etc.
                   Separated by space "a b c" https://aka.ms/vs/workloads

 -vswhere {v}
  * 2.6.7 ...
  * latest - To get latest remote vswhere.exe
  * local  - To use only local
            (.bat;.exe /or from +15.2.26418.1 VS-build)

 -no-cache         - Do not cache vswhere for this request.
 -reset-cache      - To reset all cached vswhere versions before processing.
 -cs               - Adds to -priority C# / VB Roslyn compilers.
 -vc               - Adds to -priority VC++ toolset.
 ~c {name}         - Alias to p:Configuration={name}
 ~p {name}         - Alias to p:Platform={name}
 ~x                - Alias to m:NUMBER_OF_PROCESSORS-1 v:m
 -notamd64         - To use 32bit version of found msbuild.exe if it's possible.
 -stable           - It will ignore possible beta releases in last attempts.
 -eng              - Try to use english language for all build messages.
 -GetNuTool {args} - Access to GetNuTool core. https://github.com/3F/GetNuTool
 -only-path        - Only display fullpath to found MSBuild.
 -force            - Aggressive behavior for -priority, -notamd64, etc.
 -vsw-as "args..." - Reassign default commands to vswhere if used.
 -debug            - To show additional information from hMSBuild
 -version          - Display version of hMSBuild.
 -help             - Display this help. Aliases: -? -h

Integration with scripts

batch (.bat, .cmd)

hMSBuild is a pure batch script. Therefore, you can easily combine this even inside other batch scripts. Or invoke this externally, there's nothing special:

set msbuild=hMSBuild -notamd64 ~c Release
...
%msbuild% Conari.sln /t:Rebuild
for /F "tokens=*" %%i in ('hMSBuild -only-path -notamd64') do set msbuild="%%i"
...
%msbuild% /version
hmsbuild -cs -no-less-15 ~c Debug ~x || goto failed

More actual examples can be found in tests/ folder.

Note: for some cases, if you know what you're doing, you can also configure __p_call flag to eliminate the difference for the call-type invoking hMSBuild.bat

set __p_call=1

Build & Tests

build and tests was based on batch and vssbe scripts. You don't need to do anything else, just build and test it

build & tests

Build and Use from source

git clone https://github.com/3F/hMSBuild.git src
cd src & build & bin\Release\hMSBuild -help

.sha1 official distribution

hMSBuild releases are now accompanied by a .sha1 file in the official distribution; At the same time, commits from which releases are published are signed with the committer's verified signature (GPG).

Make sure you are using official, unmodified, safe versions.

Note: .sha1 file is a text list of published files with checksums in the format:

40-hexadecimal-digits <space> file

eead8f5c1fdff2abd4da7d799fbbe694d392c792 path\file
...

Contributing

hMSBuild is waiting for your awesome contributions!