Skip to content

Commit

Permalink
feat: Respect $(DOTNET_HOST_PATH) If Set
Browse files Browse the repository at this point in the history
The variable `DOTNET_HOST_PATH` is used by `dotnet` to expose the path to the current invocation of the host. Tools should use it when making nested calls.

<https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variables#dotnet_host_path>
  • Loading branch information
iwillspeak committed Aug 5, 2024
1 parent 2e48c6e commit abf6e36
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion MinVer/build/MinVer.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
<NoWarn>$(NoWarn);NU5105</NoWarn>
</PropertyGroup>

<PropertyGroup>
<DotNetPath>$(DOTNET_HOST_PATH)</DotNetPath>
<DotNetPath Condition=" '$(DotNetPath)' == '' ">dotnet</DotNetPath>
</PropertyGroup>

<Target Name="_MinVerClean" BeforeTargets="Clean" DependsOnTargets="MinVer" Condition="'$(GeneratePackageOnBuild)' == 'true'" />

<Target Name="MinVer" BeforeTargets="BeforeCompile;GetAssemblyVersion;CoreCompile" Condition="'$(DesignTimeBuild)' != 'true' AND '$(MinVerSkip)' != 'true'">
Expand Down Expand Up @@ -45,7 +50,7 @@
<MinVerInputs Include="--verbosity &quot;$(MinVerVerbosity)&quot;" />
<MinVerInputs Include="--version-override &quot;$(MinVerVersionOverride)&quot;" />
</ItemGroup>
<Exec Command="dotnet &quot;$(MSBuildThisFileDirectory)bin/$(MinVerTargetFramework)/MinVer.dll&quot; @(MinVerInputs->'%(Identity)', ' ')" ConsoleToMSBuild="true" StandardOutputImportance="Low" >
<Exec Command="&quot;$(DotNetPath)&quot; &quot;$(MSBuildThisFileDirectory)bin/$(MinVerTargetFramework)/MinVer.dll&quot; @(MinVerInputs->'%(Identity)', ' ')" ConsoleToMSBuild="true" StandardOutputImportance="Low" >
<Output TaskParameter="ConsoleOutput" ItemName="MinVerConsoleOutput" />
</Exec>
<ItemGroup>
Expand Down

0 comments on commit abf6e36

Please sign in to comment.