title: MSBuild use local .NET tool if available falling back to global tool if not
body: <p>I have an MSBuild project with a target that depends on a <a href="https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools" rel="nofollow noreferrer">.NET tool</a> (let's call it <code>do-stuff-tool</code>).</p>
  <p>.NET tools can be installed globally and/or locally, and developers using the MSBuild project may have the stable version of the tool installed globally and a development version installed locally. The syntax for running the tool depends on whether it's locally or globally installed (<code>dotnet do-stuff-tool</code> vs simply <code>do-stuff-tool</code>)</p>
  <p>I want my MSBuild project to work with both local and global installs of <code>do-stuff-tool</code>, running the local version of the tool if it's available, and falling back to the global version if not, without the developer having to make any config changes to select which.</p>
  <p>I could a write shell script to parse the output of <code>dotnet tool list</code> and <code>dotnet tool list -g</code> but I'd prefer an idiomatic MSBuild solution if possible.</p>
  <p>Is there a standard way to achieve this in MSBuild?</p>
  <p>Thanks.</p>