Skip to content

Commit b18a7a1

Browse files
iwillspeakadamralph
authored andcommitted
respect DOTNET_HOST_PATH if set
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>
1 parent e68e5f0 commit b18a7a1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

MinVer/build/MinVer.targets

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
<NoWarn>$(NoWarn);NU5105</NoWarn>
2020
</PropertyGroup>
2121

22+
<PropertyGroup>
23+
<DotNetPath>$(DOTNET_HOST_PATH)</DotNetPath>
24+
<DotNetPath Condition=" '$(DotNetPath)' == '' ">dotnet</DotNetPath>
25+
</PropertyGroup>
26+
2227
<Target Name="_MinVerClean" BeforeTargets="Clean" DependsOnTargets="MinVer" Condition="'$(GeneratePackageOnBuild)' == 'true'" />
2328

2429
<Target Name="MinVer" BeforeTargets="BeforeCompile;GetAssemblyVersion;CoreCompile" Condition="'$(DesignTimeBuild)' != 'true' AND '$(MinVerSkip)' != 'true'">
@@ -51,7 +56,7 @@
5156
</ItemGroup>
5257
<CacheGet Key="@(MinVerInputs->'%(Identity)', ' ')"><Output TaskParameter="Value" PropertyName="MinVerVersion" /></CacheGet>
5358
<Message Condition="'$(MinVerVersion)' != ''" Importance="$(MinVerDetailed)" Text="MinVer: Using cached MinVerVersion $(MinVerVersion)" />
54-
<Exec Condition="'$(MinVerVersion)' == ''" Command="dotnet &quot;$(MSBuildThisFileDirectory)bin/$(MinVerTargetFramework)/MinVer.dll&quot; &quot;$(MSBuildProjectDirectory)&quot; @(MinVerInputs->'%(Identity)', ' ')" ConsoleToMSBuild="true" StandardOutputImportance="Low" >
59+
<Exec Condition="'$(MinVerVersion)' == ''" Command="&quot;$(DotNetPath)&quot; &quot;$(MSBuildThisFileDirectory)bin/$(MinVerTargetFramework)/MinVer.dll&quot; &quot;$(MSBuildProjectDirectory)&quot; @(MinVerInputs->'%(Identity)', ' ')" ConsoleToMSBuild="true" StandardOutputImportance="Low" >
5560
<Output TaskParameter="ConsoleOutput" ItemName="MinVerConsoleOutput" />
5661
</Exec>
5762
<ItemGroup Condition="'$(MinVerVersion)' == ''" >

0 commit comments

Comments
 (0)