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