I was having difficulties with the included .NET 5.0.1 detection routine that is included with IA Developer X13, so I decided to create my own. The reason is the .NET 5 puts its version information in one of 2 places in the registry, and one of those key/value pairs sometimes contains incorrect data. My script attempts to overcome that.
This detects and installs .NET Desktop Runtime 5.0.4 (which includes .NET 5.0.4 Runtime), the latest bugfix release at the time I posted. These are meant to operate in your PREREQ section. This script is assumes you are running a hybrid x86/x64 installation that has already set the AMD64 variable as needed. Please feel free to use and edit as necessary. I hope it helps when migrating to .NET 5.
Requirements
* Your setup needs to make sure its running Windows 7 SP1 or later (this is a .NET 5 requirement enforced by Microsoft's installer)
* You will provide the .NET Desktop Runtime for both x86 and x64 systems, which you can download from the Microsoft website - or your setup can point to the .NET installer exe files that Microsoft hosts (https://dotnet.microsoft.com/download/dotnet/5.0)
Detection Script
Code: Select all
~InstallAware Clipboard Data~
~End~
~{8A74C199-96D8-4E0C-841E-BE1C0E7DC100}~
~End~
~{8913EB19-1629-4EC8-84A7-7D1B34515783}~
~Set Variable~
~{26D54B0A-43A2-4BFC-BD1D-B69DF19CF218}~
~PRELIST$MYAH$MYAH$FALSE~
~$PRELIST$$NEWLINE$Microsoft .NET 5.0.4 (x64)~
~Comment~
~{D9245937-790A-49AB-84AA-4C675E83B374}~
~Check for .NET 5 x64~
~If~
~{79FE2E6B-3E05-446C-A058-7DEF34B1F83C}~
~SYSTEM_TYPE~
~0~
~AMD64~
~FALSE~
~Set Variable~
~{83C32791-9CCC-4912-AE6E-E74123C5A69B}~
~PRELIST$MYAH$MYAH$FALSE~
~$PRELIST$$NEWLINE$Microsoft .NET 5.0.4 (x86)~
~Comment~
~{BD5904DA-E2A4-45AD-A8E8-A40DADAB3A3B}~
~Check for .NET 5 x86, even on 64-bit machines~
~Set Variable~
~{2BE7307C-4F74-4671-B066-834CD8246A6A}~
~INSTALL_DOTNET5$MYAH$MYAH$FALSE~
~TRUE~
~Set Variable~
~{0B793222-B8A3-4F33-950A-B6E5B6616A09}~
~PREREQ~
~TRUE~
~Comment~
~{8942DDFE-2B7F-40AE-80B7-CEE7D2799F9D}~
~Need to install .NET 5~
~Else~
~{E5DA73B8-6D1E-43BB-9587-4D80CA1B87E8}~
~GoTo Label~
~{F5043316-77EF-462D-BD6C-21BE1397BDB5}~
~IA Previous Version Check~
~Comment~
~{105F138D-794C-470E-A8CF-5FF6FE21FEE2}~
~.NET 5 is installed~
~If~
~{F8414D04-D515-4FFA-ABC9-FCFF77CE6185}~
~DOTNET5_VERSION~
~6~
~5.0.3~
~FALSE~
~End~
~{5FE3572A-F727-4212-8818-2756D7034480}~
~End~
~{31F2C89E-CF36-47CB-8A6A-D1B8A27171B5}~
~Read Registry~
~{8616DFD6-9386-4DD1-BE9A-1AAE73BA7493}~
~DOTNET5_VERSION|~
~2~
~SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\x86\sharedhost~
~Version~
~If~
~{81D23F5A-4621-4EFC-A1AF-6F346EFD37CC}~
~SYSTEM_TYPE~
~0~
~AMD64~
~FALSE~
~Read Registry~
~{424F0663-D65E-42A4-AF29-0622FD44002D}~
~DOTNET5_VERSION|~
~2~
~SOFTWARE\dotnet\Setup\InstalledVersions\x86\sharedhost~
~Version~
~If~
~{2534C500-61C7-466F-B7A7-FD3B8A38EB2D}~
~DOTNET5_VERSION~
~6~
~5.0.3~
~TRUE~
~End~
~{544CA7E9-940C-4FB7-B052-E41BD5AD4254}~
~Read Registry~
~{86DD452E-9E93-48A7-9D09-8DC0740D6F7F}~
~DOTNET5_VERSION|~
~2~
~SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\x86\hostfxr~
~Version~
~If~
~{870B94D5-F0D8-49D9-9B79-4D30DFB245B3}~
~SYSTEM_TYPE~
~0~
~AMD64~
~FALSE~
~Read Registry~
~{7D8591CB-131E-4377-B6DE-DDEA12DD7061}~
~DOTNET5_VERSION|~
~2~
~SOFTWARE\dotnet\Setup\InstalledVersions\x86\hostfxr~
~Version~
~Label~
~{A9053671-8ACB-43EC-B9AF-223651AFF859}~
~.NET 5 Check~
~Comment~
~{E6E1DF9B-CA7A-47A2-984D-5B17FAAA0BA2}~
~This is a lot more complicated than .NET Framework 4.8 or lower~
~Comment~
~{8CD31C53-5E6C-435F-8001-B509E0F88024}~
~Look for .NET 5 (There are two different places in the Registry)~
Installation Script
Code: Select all
~InstallAware Clipboard Data~
~End~
~{7EFA425C-1436-4F2D-BBED-62E3C2098843}~
~End~
~{78B7996E-805E-4161-A78F-AB1867D63429}~
~Set Variable~
~{15111C7D-2D5A-406A-959F-793000A2F427}~
~REBOOTCOMPUTER$MYAH$MYAH$FALSE~
~TRUE~
~If~
~{1C68807E-8EDD-4E15-A38D-E986F1FE7DE9}~
~DOTNET5_RETURN~
~0~
~3010~
~FALSE~
~End~
~{5AFBD025-223C-402C-A473-BF1D947201E9}~
~Set Variable~
~{BBC43B05-5270-429B-9BE8-161C3A3650E4}~
~REBOOTCOMPUTER$MYAH$MYAH$FALSE~
~TRUE~
~If~
~{22B626FD-BCCE-4023-9B58-F54212C99797}~
~DOTNET5_RETURN~
~0~
~23~
~FALSE~
~Comment~
~{896A612F-C439-4B1E-B12C-968588372992}~
~Request a Reboot at the end of Setup~
~End~
~{80488915-1651-4D3E-9E9F-E1F3C670C0AC}~
~Run Program As~
~{17254BC2-5C35-490E-9980-A0A4F16338F4}~
~$DOTNET5_X64$\dotnet5-x64.exe~
~~
~/install /norestart /quiet~
~0~
~$MYAH_UACEX$~
~~
~~
~DOTNET5_RETURN~
~TRUE~
~~
~File Bag~
~{A98933D0-08CA-4B1F-B0DC-D7D5FF59CC76}~
~"C:\Users\Micha\Dropbox\Tools\Setup Tools\Runtimes\dotnet5\dotnet5-x64.exe|",FALSE,DOTNET5_X64~
~mFileBagIDE.dll\mFileBagEXE.dll~
~Set Variable~
~{574B39DA-A4BC-42BB-BA0B-6F3D8B333357}~
~DOTNET5_X64$MYAH$MYAH$FALSE~
~~
~Set Variable~
~{3CCCE49B-F842-425D-AB8E-20049B7FE6A1}~
~PROGRESSTEXT$MYAH$MYAH$FALSE~
~Installing Microsoft .NET Desktop Runtime 5.0.4 (x64)...~
~Set Variable~
~{A3C44165-42C9-46D5-BBAC-3A762E79B8A7}~
~PROGRESSMODE$MYAH$MYAH$FALSE~
~MARQUEE~
~Web Media Block~
~{AA019F92-8E08-49FA-BE46-E730C8FD2466}~
~Microsoft .NET 5 x64~
~https://raggiesoft.com/downloads/syscomp/dotnet/dot504-x64.7zip~
~FALSE$MYAH_CARET$~
~Comment~
~{2D07DA85-5192-4A0B-86E3-C84CC2F0E06E}~
~Install .NET 5 x64~
~If~
~{F7D2272D-0B99-4E28-BD43-0E22BDE7514B}~
~SYSTEM_TYPE~
~0~
~AMD64~
~FALSE~
~Run Program As~
~{634852A1-4C84-4070-885B-6426269E24C4}~
~$DOTNET5_X86$\dotnet5-x86.exe~
~~
~/install /norestart /quiet~
~0~
~$MYAH_UACEX$~
~~
~~
~DOTNET5_RETURN~
~TRUE~
~~
~File Bag~
~{EA8F4830-439E-433E-BA28-CC6F560DE79A}~
~"C:\Users\Micha\Dropbox\Tools\Setup Tools\Runtimes\dotnet5\dotnet5-x64.exe|",FALSE,DOTNET5_X86~
~mFileBagIDE.dll\mFileBagEXE.dll~
~Set Variable~
~{33D11515-9BFD-4223-B44F-E231CF181E5C}~
~DOTNET5_X86$MYAH$MYAH$FALSE~
~~
~Set Variable~
~{61981289-CDDF-483A-BA53-5486367357E1}~
~PROGRESSTEXT$MYAH$MYAH$FALSE~
~Installing Microsoft .NET Desktop Runtime 5.0.4 (x86)...~
~Set Variable~
~{01AB49B6-3A02-4791-AEEC-F815F17BB8B1}~
~PROGRESSMODE$MYAH$MYAH$FALSE~
~MARQUEE~
~Web Media Block~
~{F5BF63B7-394E-4C20-8B42-A5B283407AAE}~
~Microsoft .NET 5 x86~
~https://raggiesoft.com/downloads/syscomp/dotnet/dot504-x86.7zip~
~FALSE$MYAH_CARET$~
~Comment~
~{C10E1063-220E-4ABC-B604-66D261606A37}~
~Install .NET 5 x86~
~If~
~{0AEF1B38-B6B5-4786-BEAA-67313F23C818}~
~INSTALL_DOTNET5~
~0~
~TRUE~
~FALSE~
~Comment~
~{887D1ADE-4191-41C5-B2CE-FB412C9A36D3}~
~Install .NET 5 as needed~