@@ -201,25 +201,38 @@ public override bool Execute() {
201
201
</Target >
202
202
203
203
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 -->
210
206
<PropertyGroup Condition =" $(PlatformToolset) == 'v140'" >
211
207
<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 >
212
223
<VCRedistDir Condition =" $(Platform) == 'Win32'" >$(VCRedistDir)x86\</VCRedistDir >
213
224
<VCRedistDir Condition =" $(Platform) != 'Win32'" >$(VCRedistDir)$(Platform)\</VCRedistDir >
214
225
</PropertyGroup >
215
226
227
+ <Message Text =" VC Redist Directory: $(VCRedistDir)" />
228
+ </Target >
229
+
230
+ <Target Name =" FindVCRuntime" Returns =" VCRuntimeDLL" DependsOnTargets =" FindVCRedistDir" >
216
231
<ItemGroup Condition =" $(VCInstallDir) != ''" >
217
232
<VCRuntimeDLL Include =" $(VCRedistDir)\Microsoft.VC*.CRT\vcruntime*.dll" />
218
- <_AllRedist Include =" $(VCInstallDir)\Redist\**" />
219
233
</ItemGroup >
220
234
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- ')" />
224
237
</Target >
225
238
</Project >
0 commit comments