@@ -201,23 +201,41 @@ 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
+
210
+ <!-- Search for version number in some broken Build Tools installs -->
211
+ <ItemGroup Condition =" $(VCRedistDir) == '' and $(VCToolsRedistVersion) == ''" >
212
+ <_RedistFiles Include =" $(VCInstallDir)\Redist\MSVC\*\*.*" />
213
+ </ItemGroup >
214
+ <PropertyGroup Condition =" $(VCRedistDir) == '' and $(VCToolsRedistVersion) == ''" >
215
+ <_RedistDir >%(_RedistFiles.Directory)</_RedistDir >
216
+ <VCToolsRedistVersion >$([System.IO.Path]::GetFileName($(_RedistDir.Trim(`\`))))</VCToolsRedistVersion >
217
+ </PropertyGroup >
218
+
219
+ <!-- Use correct path for VS 2017 and later -->
220
+ <PropertyGroup Condition =" $(VCRedistDir) == ''" >
221
+ <VCRedistDir >$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\</VCRedistDir >
222
+ </PropertyGroup >
223
+
224
+ <PropertyGroup >
212
225
<VCRedistDir Condition =" $(Platform) == 'Win32'" >$(VCRedistDir)x86\</VCRedistDir >
213
226
<VCRedistDir Condition =" $(Platform) != 'Win32'" >$(VCRedistDir)$(Platform)\</VCRedistDir >
214
227
</PropertyGroup >
215
228
229
+ <Message Text =" VC Redist Directory: $(VCRedistDir)" />
230
+ <Message Text =" VC Redist Version: $(VCToolsRedistVersion)" />
231
+ </Target >
232
+
233
+ <Target Name =" FindVCRuntime" Returns =" VCRuntimeDLL" DependsOnTargets =" FindVCRedistDir" >
216
234
<ItemGroup Condition =" $(VCInstallDir) != ''" >
217
235
<VCRuntimeDLL Include =" $(VCRedistDir)\Microsoft.VC*.CRT\vcruntime*.dll" />
218
236
</ItemGroup >
219
237
220
- <Warning Text =" vcruntime14 *.dll not found under $(VCInstallDir) " Condition =" @(VCRuntimeDLL) == ''" />
221
- <Message Text =" VCRuntimeDLL: @(VCRuntimeDLL) " Importance = " high " />
238
+ <Warning Text =" vcruntime *.dll not found under $(VCRedistDir). " Condition =" @(VCRuntimeDLL) == ''" />
239
+ <Message Text =" VC Runtime DLL(s):%0A- @(VCRuntimeDLL,'%0A- ') " />
222
240
</Target >
223
241
</Project >
0 commit comments