@@ -202,23 +202,41 @@ public override bool Execute() {
202
202
</Target >
203
203
204
204
205
- <Target Name =" FindVCRuntime" Returns =" VCRuntimeDLL" >
206
- <PropertyGroup Condition =" $(PlatformToolset) != 'v140'" >
207
- <VCRedistDir >$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\</VCRedistDir >
208
- <VCRedistDir Condition =" $(Platform) == 'Win32'" >$(VCRedistDir)x86\</VCRedistDir >
209
- <VCRedistDir Condition =" $(Platform) != 'Win32'" >$(VCRedistDir)$(Platform)\</VCRedistDir >
210
- </PropertyGroup >
205
+ <Target Name =" FindVCRedistDir" >
206
+ <!-- Hard coded path for VS 2015 -->
211
207
<PropertyGroup Condition =" $(PlatformToolset) == 'v140'" >
212
208
<VCRedistDir >$(VCInstallDir)\redist\</VCRedistDir >
209
+ </PropertyGroup >
210
+
211
+ <!-- Search for version number in some broken Build Tools installs -->
212
+ <ItemGroup Condition =" $(VCRedistDir) == '' and $(VCToolsRedistVersion) == ''" >
213
+ <_RedistFiles Include =" $(VCInstallDir)\Redist\MSVC\*\*.*" />
214
+ </ItemGroup >
215
+ <PropertyGroup Condition =" $(VCRedistDir) == '' and $(VCToolsRedistVersion) == ''" >
216
+ <_RedistDir >%(_RedistFiles.Directory)</_RedistDir >
217
+ <VCToolsRedistVersion >$([System.IO.Path]::GetFileName($(_RedistDir.Trim(`\`))))</VCToolsRedistVersion >
218
+ </PropertyGroup >
219
+
220
+ <!-- Use correct path for VS 2017 and later -->
221
+ <PropertyGroup Condition =" $(VCRedistDir) == ''" >
222
+ <VCRedistDir >$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\</VCRedistDir >
223
+ </PropertyGroup >
224
+
225
+ <PropertyGroup >
213
226
<VCRedistDir Condition =" $(Platform) == 'Win32'" >$(VCRedistDir)x86\</VCRedistDir >
214
227
<VCRedistDir Condition =" $(Platform) != 'Win32'" >$(VCRedistDir)$(Platform)\</VCRedistDir >
215
228
</PropertyGroup >
216
229
230
+ <Message Text =" VC Redist Directory: $(VCRedistDir)" />
231
+ <Message Text =" VC Redist Version: $(VCToolsRedistVersion)" />
232
+ </Target >
233
+
234
+ <Target Name =" FindVCRuntime" Returns =" VCRuntimeDLL" DependsOnTargets =" FindVCRedistDir&qu
6D1B
ot; >
217
235
<ItemGroup Condition =" $(VCInstallDir) != ''" >
218
236
<VCRuntimeDLL Include =" $(VCRedistDir)\Microsoft.VC*.CRT\vcruntime*.dll" />
219
237
</ItemGroup >
220
238
221
- <Warning Text =" vcruntime14 *.dll not found under $(VCInstallDir) " Condition =" @(VCRuntimeDLL) == ''" />
222
- <Message Text =" VCRuntimeDLL: @(VCRuntimeDLL) " Importance = " high " />
239
+ <Warning Text =" vcruntime *.dll not found under $(VCRedistDir). " Condition =" @(VCRuntimeDLL) == ''" />
240
+ <Message Text =" VC Runtime DLL(s):%0A- @(VCRuntimeDLL,'%0A- ') " />
223
241
</Target >
224
242
</Project >
0 commit comments