Skip to content

Commit d828efc

Browse files
committed
Try another approach to searching for the redist
1 parent e7d917f commit d828efc

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

PCbuild/pyproject.props

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,25 +201,38 @@ public override bool Execute() {
201201
</Target>
202202

203203

204-
<Target Name="FindVCRuntime" Returns="VCRuntimeDLL">
205-
<PropertyGroup Condition="$(PlatformToolset) != 'v140'">
206-
<VCRedistDir>$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\</VCRedistDir>
207-
<VCRedistDir Condition="$(Platform) == 'Win32'">$(VCRedistDir)x86\</VCRedistDir>
208-
<VCRedistDir Condition="$(Platform) != 'Win32'">$(VCRedistDir)$(Platform)\</VCRedistDir>
209-
</PropertyGroup>
204+
<Target Name="FindVCRedistDir">
205+
<!-- Hard coded path for VS 2015 -->
210206
<PropertyGroup Condition="$(PlatformToolset) == 'v140'">
211207
<VCRedistDir>$(VCInstallDir)\redist\</VCRedistDir>
208+
</PropertyGroup>
209+
<!-- Correct variable for VS 2017 and later -->
210+
<PropertyGroup Condition="$(VCRedistDir) == '' and $(VCToolsRedistVersion) != ''">
211+
<VCRedistDir>$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\</VCRedistDir>
212+
</PropertyGroup>
213+
214+
<!-- Search in some broken Build Tools installs -->
215+
<ItemGroup Condition="$(VCRedistDir) == ''">
216+
<_RedistFiles Include="$(VCInstallDir)\Redist\MSVC\*\*.*" />
217+
</ItemGroup>
218+
<PropertyGroup Condition="$(VCRedistDir) == ''">
219+
<VCRedistDir>%(_RedistFiles.RootDir)%(_RedistFiles.Directory)</VCRedistDir>
220+
</PropertyGroup>
221+
222+
<PropertyGroup>
212223
<VCRedistDir Condition="$(Platform) == 'Win32'">$(VCRedistDir)x86\</VCRedistDir>
213224
<VCRedistDir Condition="$(Platform) != 'Win32'">$(VCRedistDir)$(Platform)\</VCRedistDir>
214225
</PropertyGroup>
215226

227+
<Message Text="VC Redist Directory: $(VCRedistDir)" />
228+
</Target>
229+
230+
<Target Name="FindVCRuntime" Returns="VCRuntimeDLL" DependsOnTargets="FindVCRedistDir">
216231
<ItemGroup Condition="$(VCInstallDir) != ''">
217232
<VCRuntimeDLL Include="$(VCRedistDir)\Microsoft.VC*.CRT\vcruntime*.dll" />
218-
<_AllRedist Include="$(VCInstallDir)\Redist\**" />
219233
</ItemGroup>
220234

221-
<Warning Text="vcruntime14*.dll not found under $(VCRedistDir)." Condition="@(VCRuntimeDLL) == ''" />
222-
<Message Text="Found @(_AllRedist,'%0A')" Importance="high" Condition="@(VCRuntimeDLL) == ''" />
223-
<Message Text="VCRuntimeDLL: @(VCRuntimeDLL)" Importance="high" />
235+
<Warning Text="vcruntime*.dll not found under $(VCRedistDir)." Condition="@(VCRuntimeDLL) == ''" />
236+
<Message Text="VC Runtime DLL(s):%0A- @(VCRuntimeDLL,'%0A- ')" />
224237
</Target>
225238
</Project>

0 commit comments

Comments
 (0)