@@ -218,15 +218,30 @@ begin
218218 Result := Dependency_String(' (x86)' , ' (x64)' );
219219end ;
220220
221- function Dependency_IsNetCoreInstalled (const Version : String): Boolean;
221+ function Dependency_IsNetCoreInstalled (Runtime : String; Major, Minor, Revision: Word ): Boolean;
222222var
223223 ResultCode: Integer;
224+ Output: TExecOutput;
225+ LineIndex: Integer;
226+ LineParts: TArrayOfString;
227+ PackedVersion: Int64;
228+ LineMajor, LineMinor, LineRevision, LineBuild: Word;
224229begin
225- // source code: https://github.com/dotnet/deployment-tools/tree/main/src/clickonce/native/projects/NetCoreCheck
226- if not FileExists(ExpandConstant(' {tmp}{\}' ) + ' netcorecheck' + Dependency_ArchSuffix + ' .exe' ) then begin
227- ExtractTemporaryFile(' netcorecheck' + Dependency_ArchSuffix + ' .exe' );
230+ Result := False;
231+ if ExecAndCaptureOutput(ExpandConstant(' {cmd}' ),' /C dotnet --list-runtimes' , ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode, Output) and (ResultCode = 0 ) then begin
232+ for LineIndex := 0 to Length(Output.StdOut) - 1 do begin
233+ LineParts := StringSplit(Trim(Output.StdOut[LineIndex]), [' ' ], stExcludeEmpty);
234+
235+ if (Length(LineParts) > 1 ) and (Lowercase(LineParts[0 ]) = Lowercase(Runtime)) and StrToVersion(LineParts[1 ], PackedVersion) then begin
236+ UnpackVersionComponents(PackedVersion, LineMajor, LineMinor, LineRevision, LineBuild);
237+
238+ if (LineMajor = Major) and (LineMinor = Minor) and (LineRevision >= Revision) then begin
239+ Result := True;
240+ break;
241+ end ;
242+ end ;
243+ end ;
228244 end ;
229- Result := ShellExec(' ' , ExpandConstant(' {tmp}{\}' ) + ' netcorecheck' + Dependency_ArchSuffix + ' .exe' , Version, ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode) and (ResultCode = 0 );
230245end ;
231246
232247procedure Dependency_AddDotNet35 ;
318333procedure Dependency_AddNetCore31 ;
319334begin
320335 // https://dotnet.microsoft.com/download/dotnet-core/3.1
321- if not Dependency_IsNetCoreInstalled(' -n Microsoft.NETCore.App -v 3.1.32 ' ) then begin
336+ if not Dependency_IsNetCoreInstalled(' Microsoft.NETCore.App' , 3 , 1 , 32 ) then begin
322337 Dependency_Add(' netcore31' + Dependency_ArchSuffix + ' .exe' ,
323338 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
324339 ' .NET Core Runtime 3.1.32' + Dependency_ArchTitle,
330345procedure Dependency_AddNetCore31Asp ;
331346begin
332347 // https://dotnet.microsoft.com/download/dotnet-core/3.1
333- if not Dependency_IsNetCoreInstalled(' -n Microsoft.AspNetCore.App -v 3.1.32 ' ) then begin
348+ if not Dependency_IsNetCoreInstalled(' Microsoft.AspNetCore.App' , 3 , 1 , 32 ) then begin
334349 Dependency_Add(' netcore31asp' + Dependency_ArchSuffix + ' .exe' ,
335350 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
336351 ' ASP.NET Core Runtime 3.1.32' + Dependency_ArchTitle,
342357procedure Dependency_AddNetCore31Desktop ;
343358begin
344359 // https://dotnet.microsoft.com/download/dotnet-core/3.1
345- if not Dependency_IsNetCoreInstalled(' -n Microsoft.WindowsDesktop.App -v 3.1.32 ' ) then begin
360+ if not Dependency_IsNetCoreInstalled(' Microsoft.WindowsDesktop.App' , 3 , 1 , 32 ) then begin
346361 Dependency_Add(' netcore31desktop' + Dependency_ArchSuffix + ' .exe' ,
347362 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
348363 ' .NET Desktop Runtime 3.1.32' + Dependency_ArchTitle,
354369procedure Dependency_AddDotNet50 ;
355370begin
356371 // https://dotnet.microsoft.com/download/dotnet/5.0
357- if not Dependency_IsNetCoreInstalled(' -n Microsoft.NETCore.App -v 5.0.17 ' ) then begin
372+ if not Dependency_IsNetCoreInstalled(' Microsoft.NETCore.App' , 5 , 0 , 17 ) then begin
358373 Dependency_Add(' dotnet50' + Dependency_ArchSuffix + ' .exe' ,
359374 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
360375 ' .NET Runtime 5.0.17' + Dependency_ArchTitle,
366381procedure Dependency_AddDotNet50Asp ;
367382begin
368383 // https://dotnet.microsoft.com/download/dotnet/5.0
369- if not Dependency_IsNetCoreInstalled(' -n Microsoft.AspNetCore.App -v 5.0.17 ' ) then begin
384+ if not Dependency_IsNetCoreInstalled(' Microsoft.AspNetCore.App' , 5 , 0 , 17 ) then begin
370385 Dependency_Add(' dotnet50asp' + Dependency_ArchSuffix + ' .exe' ,
371386 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
372387 ' ASP.NET Core Runtime 5.0.17' + Dependency_ArchTitle,
378393procedure Dependency_AddDotNet50Desktop ;
379394begin
380395 // https://dotnet.microsoft.com/download/dotnet/5.0
381- if not Dependency_IsNetCoreInstalled(' -n Microsoft.WindowsDesktop.App -v 5.0.17 ' ) then begin
396+ if not Dependency_IsNetCoreInstalled(' Microsoft.WindowsDesktop.App' , 5 , 0 , 17 ) then begin
382397 Dependency_Add(' dotnet50desktop' + Dependency_ArchSuffix + ' .exe' ,
383398 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
384399 ' .NET Desktop Runtime 5.0.17' + Dependency_ArchTitle,
390405procedure Dependency_AddDotNet60 ;
391406begin
392407 // https://dotnet.microsoft.com/download/dotnet/6.0
393- if not Dependency_IsNetCoreInstalled(' -n Microsoft.NETCore.App -v 6.0.20 ' ) then begin
408+ if not Dependency_IsNetCoreInstalled(' Microsoft.NETCore.App' , 6 , 0 , 20 ) then begin
394409 Dependency_Add(' dotnet60' + Dependency_ArchSuffix + ' .exe' ,
395410 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
396411 ' .NET Runtime 6.0.20' + Dependency_ArchTitle,
402417procedure Dependency_AddDotNet60Asp ;
403418begin
404419 // https://dotnet.microsoft.com/download/dotnet/6.0
405- if not Dependency_IsNetCoreInstalled(' -n Microsoft.AspNetCore.App -v 6.0.20 ' ) then begin
420+ if not Dependency_IsNetCoreInstalled(' Microsoft.AspNetCore.App' , 6 , 0 , 20 ) then begin
406421 Dependency_Add(' dotnet60asp' + Dependency_ArchSuffix + ' .exe' ,
407422 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
408423 ' ASP.NET Core Runtime 6.0.20' + Dependency_ArchTitle,
414429procedure Dependency_AddDotNet60Desktop ;
415430begin
416431 // https://dotnet.microsoft.com/download/dotnet/6.0
417- if not Dependency_IsNetCoreInstalled(' -n Microsoft.WindowsDesktop.App -v 6.0.20 ' ) then begin
432+ if not Dependency_IsNetCoreInstalled(' Microsoft.WindowsDesktop.App' , 6 , 0 , 20 ) then begin
418433 Dependency_Add(' dotnet60desktop' + Dependency_ArchSuffix + ' .exe' ,
419434 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
420435 ' .NET Desktop Runtime 6.0.20' + Dependency_ArchTitle,
426441procedure Dependency_AddDotNet70 ;
427442begin
428443 // https://dotnet.microsoft.com/download/dotnet/7.0
429- if not Dependency_IsNetCoreInstalled(' -n Microsoft.NETCore.App -v 7.0.9 ' ) then begin
444+ if not Dependency_IsNetCoreInstalled(' Microsoft.NETCore.App' , 7 , 0 , 9 ) then begin
430445 Dependency_Add(' dotnet70' + Dependency_ArchSuffix + ' .exe' ,
431446 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
432447 ' .NET Runtime 7.0.9' + Dependency_ArchTitle,
438453procedure Dependency_AddDotNet70Asp ;
439454begin
440455 // https://dotnet.microsoft.com/download/dotnet/7.0
441- if not Dependency_IsNetCoreInstalled(' -n Microsoft.AspNetCore.App -v 7.0.9 ' ) then begin
456+ if not Dependency_IsNetCoreInstalled(' Microsoft.AspNetCore.App' , 7 , 0 , 9 ) then begin
442457 Dependency_Add(' dotnet70asp' + Dependency_ArchSuffix + ' .exe' ,
443458 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
444459 ' ASP.NET Core Runtime 7.0.9' + Dependency_ArchTitle,
450465procedure Dependency_AddDotNet70Desktop ;
451466begin
452467 // https://dotnet.microsoft.com/download/dotnet/7.0
453- if not Dependency_IsNetCoreInstalled(' -n Microsoft.WindowsDesktop.App -v 7.0.9 ' ) then begin
468+ if not Dependency_IsNetCoreInstalled(' Microsoft.WindowsDesktop.App' , 7 , 0 , 9 ) then begin
454469 Dependency_Add(' dotnet70desktop' + Dependency_ArchSuffix + ' .exe' ,
455470 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
456471 ' .NET Desktop Runtime 7.0.9' + Dependency_ArchTitle,
463478procedure Dependency_AddDotNet80 ;
464479begin
465480 // https://dotnet.microsoft.com/download/dotnet/8.0
466- if not Dependency_IsNetCoreInstalled(' -n Microsoft.NETCore.App -v 8.0.10 ' ) then begin
481+ if not Dependency_IsNetCoreInstalled(' Microsoft.NETCore.App' , 8 , 0 , 10 ) then begin
467482 Dependency_Add(' dotnet80' + Dependency_ArchSuffix + ' .exe' ,
468483 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
469484 ' .NET Runtime 8.0.10' + Dependency_ArchTitle,
475490procedure Dependency_AddDotNet80Asp ;
476491begin
477492 // https://dotnet.microsoft.com/download/dotnet/8.0
478- if not Dependency_IsNetCoreInstalled(' -n Microsoft.AspNetCore.App -v 8.0.10 ' ) then begin
493+ if not Dependency_IsNetCoreInstalled(' Microsoft.AspNetCore.App' , 8 , 0 , 10 ) then begin
479494 Dependency_Add(' dotnet80asp' + Dependency_ArchSuffix + ' .exe' ,
480495 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
481496 ' ASP.NET Core Runtime 8.0.10' + Dependency_ArchTitle,
487502procedure Dependency_AddDotNet80Desktop ;
488503begin
489504 // https://dotnet.microsoft.com/download/dotnet/8.0
490- if not Dependency_IsNetCoreInstalled(' -n Microsoft.WindowsDesktop.App -v 8.0.10 ' ) then begin
505+ if not Dependency_IsNetCoreInstalled(' Microsoft.WindowsDesktop.App' , 8 , 0 , 10 ) then begin
491506 Dependency_Add(' dotnet80desktop' + Dependency_ArchSuffix + ' .exe' ,
492507 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
493508 ' .NET Desktop Runtime 8.0.10' + Dependency_ArchTitle,
499514procedure Dependency_AddDotNet90 ;
500515begin
501516 // https://dotnet.microsoft.com/download/dotnet/9.0
502- if not Dependency_IsNetCoreInstalled(' -n Microsoft.NETCore.App -v 9.0.0 ' ) then begin
517+ if not Dependency_IsNetCoreInstalled(' Microsoft.NETCore.App' , 9 , 0 , 0 ) then begin
503518 Dependency_Add(' dotnet90' + Dependency_ArchSuffix + ' .exe' ,
504519 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
505520 ' .NET Runtime 9.0.0' + Dependency_ArchTitle,
511526procedure Dependency_AddDotNet90Asp ;
512527begin
513528 // https://dotnet.microsoft.com/download/dotnet/9.0
514- if not Dependency_IsNetCoreInstalled(' -n Microsoft.AspNetCore.App -v 9.0.0 ' ) then begin
529+ if not Dependency_IsNetCoreInstalled(' Microsoft.AspNetCore.App' , 9 , 0 , 0 ) then begin
515530 Dependency_Add(' dotnet90asp' + Dependency_ArchSuffix + ' .exe' ,
516531 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
517532 ' ASP.NET Core Runtime 9.0.0' + Dependency_ArchTitle,
523538procedure Dependency_AddDotNet90Desktop ;
524539begin
525540 // https://dotnet.microsoft.com/download/dotnet/9.0
526- if not Dependency_IsNetCoreInstalled(' -n Microsoft.WindowsDesktop.App -v 9.0.0 ' ) then begin
541+ if not Dependency_IsNetCoreInstalled(' Microsoft.WindowsDesktop.App' , 9 , 0 , 0 ) then begin
527542 Dependency_Add(' dotnet90desktop' + Dependency_ArchSuffix + ' .exe' ,
528543 ' /lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart' ,
529544 ' .NET Desktop Runtime 9.0.0' + Dependency_ArchTitle,
@@ -759,13 +774,6 @@ begin
759774end ;
760775
761776[Files]
762- #ifdef Dependency_Path_NetCoreCheck
763- ; download netcorecheck.exe: https://www.nuget.org/packages/Microsoft.NET.Tools.NETCoreCheck.x86
764- ; download netcorecheck_x64.exe: https://www.nuget.org/packages/Microsoft.NET.Tools.NETCoreCheck.x64
765- Source : " {#Dependency_Path_NetCoreCheck}netcorecheck.exe" ; Flags : dontcopy noencryption
766- Source : " {#Dependency_Path_NetCoreCheck}netcorecheck_x64.exe" ; Flags : dontcopy noencryption
767- #endif
768-
769777#ifdef Dependency_Path_DirectX
770778Source : " {#Dependency_Path_DirectX}dxwebsetup.exe" ; Flags : dontcopy noencryption
771779#endif
0 commit comments