Microsoft .NET 5 - Improved Detection

Post specialized setup scripts you have created here.
raggiesoft_dotcom
Posts: 2
Joined: Wed Mar 24, 2021 10:13 am
Contact:

Microsoft .NET 5 - Improved Detection

Postby raggiesoft_dotcom » Wed Mar 24, 2021 10:35 am

Synopsis
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~

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Microsoft .NET 5 - Improved Detection

Postby FrancescoT » Wed Mar 24, 2021 3:08 pm

Thanks for posting.

However, it's not clear to me which kind of problem or difficulty you had with the IA .NET5 rtm included with IA.
Can you try to explain?
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

raggiesoft_dotcom
Posts: 2
Joined: Wed Mar 24, 2021 10:13 am
Contact:

Re: Microsoft .NET 5 - Improved Detection

Postby raggiesoft_dotcom » Wed Mar 24, 2021 3:27 pm

FrancescoT wrote:Thanks for posting.

However, it's not clear to me which kind of problem or difficulty you had with the IA .NET5 rtm included with IA.
Can you try to explain?


Yes, absolutely. The existing detection routine in InstallAware specifically checks for .NET 5 Desktop Runtime 5.0.1, and does not account for any future releases (in the case of my development machine, I have .NET 5 Desktop Runtime 5.0.4).

My script checks the two places that Microsoft places the latest version of .NET 5, one of which sometimes contains old data, then adds the .NET Desktop installer to the PREREQ queue as necessary.
Attachments
IA dotNET Error.png
This is the PREREQ dialog of the dotNET Template on a machine that has .NET 5 Desktop 5.0.4, notice that it still wants to install .NET 5 Desktop 5.0.1
IA dotNET Error.png (17.86 KiB) Viewed 14813 times
IA dotNET Error Registry.png
Here is a screen capture of the Registry key that IA's script is looking for (note the lack of a 5.0.1 key, thus the IA script fails)
IA dotNET Error Registry.png (132.91 KiB) Viewed 14813 times

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Microsoft .NET 5 - Improved Detection

Postby FrancescoT » Thu Mar 25, 2021 12:12 pm

I just did a quick test, and in all honesty, I haven't been able to replicate any of the problems you reported.

Of course, our .NET detection routine specifically checks for "NET 5 Desktop Runtime 5.0.1". This cannot be otherwise. Due the fact that "currently", we exclusively support version 5.0.1 of .NET 5 Desktop Runtime.

But at any rate, this doesn't have any impact with successive versions of .NET 5 Desktop Runtime that could be eventually present on a target system.

I just tested our .NET detection routine on a system where "NET 5 Desktop Runtime 5.0.4" was already installed, and I didn't see any problem. Our check scripts successfully detected the presence of "NET 5 Desktop Runtime 5.0.4", and then skipped the installation of v.5.0.1 as expected.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Tinus
Posts: 207
Joined: Tue Jun 20, 2006 8:42 am
Location: Germany

Re: Microsoft .NET 5 - Improved Detection

Postby Tinus » Mon Apr 12, 2021 2:45 am

Francesco,

I noticed the same issue. Try again in a system which does not have 5.0.1 installed but only 5.0.4 or later.
Then the IA script detects that 5.0.1 is missing although 5.0.4 is already installed.

Regards
Martin
Martin Rothschink
InstallAware MVP

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Microsoft .NET 5 - Improved Detection

Postby FrancescoT » Tue Apr 13, 2021 5:53 am

I just tried as you suggested, but I'm not able to replicate any issue.

I tried the following tests on a clean Win10 2004 x64 OS:

TEST 1

- manually installed .Net Desktop Runtime 5.0.4 x64
- manually installed .Net Desktop Runtime 5.0.5 x64

IA SCRIPT TEST RESULT
- v.5.0.5 x64 detected
------------------------------------------------------------------------------------------------
TEST 2 - (.Net Desktop Runtime 5.0.5 x64 installed)

- manually installed .Net Desktop Runtime 5.0.4 x86
- manually installed .Net Desktop Runtime 5.0.5 x86

IA SCRIPT TEST RESULT
- v.5.0.5 x64 detected
- v.5.0.5 x86 detected
------------------------------------------------------------------------------------------------
TEST 3 - (.Net Desktop Runtime 5.0.5 x64 and x86 installed)

- manually uninstalled .Net Desktop Runtime 5.0.5 x86

IA SCRIPT TEST RESULT
- v.5.0.5 x64 detected
- No x86 rtm detected
------------------------------------------------------------------------------------------------
TEST 4 - (.Net Desktop Runtime 5.0.5 x64 installed)

- manually uninstalled .Net Desktop Runtime 5.0.5 x64

IA SCRIPT TEST RESULT
- No x64 rtm detected
- No x86 rtm detected
*************************************************************************************************
Please let me know if you have more details to share about the test you did.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Tinus
Posts: 207
Joined: Tue Jun 20, 2006 8:42 am
Location: Germany

Re: Microsoft .NET 5 - Improved Detection

Postby Tinus » Mon Apr 19, 2021 5:14 am

Sorry Francesco,

I was talking about ASP.Net Core 5.0.1 and 5.0.5. There the scripts only checks the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET Core\Shared Framework\v5.0\5.0.1\Version.

If only 5.0.5 is installed, the key is under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET Core\Shared Framework\v5.0\5.0.5\Version

and the check returns an empty Version.

Regards
Martin
Martin Rothschink
InstallAware MVP

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Microsoft .NET 5 - Improved Detection

Postby FrancescoT » Mon Apr 19, 2021 11:34 am

Martin, thanks for letting me know.

I'll check this out.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Microsoft .NET 5 - Improved Detection

Postby FrancescoT » Thu Apr 22, 2021 9:37 am

We released a fix to correct the problem discussed previously with the detection scripts of "ASP.Net Core 5.0.1" App Rtms, and as this has been reported by Martin Rothschink (Thanks!).

The problem affected exclusively the "ASP.Net Core 5.0.1" App Rtms, and not the ".Net Desktop Runtime 5.0.1" as reported by the user who started this thread. For what concerns this last one, as I have posted previously, I have done several verifications but I don't see the presence of a problem.

The "ASP.Net Core 5.0.1" App Rtms fix will be part of a next X13 update. In the meanwhile, and untill this new update will be not officially available, those users who have a valid X13 license may contact our support (support@installaware.com) for the fixed scripts.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Tinus
Posts: 207
Joined: Tue Jun 20, 2006 8:42 am
Location: Germany

Re: Microsoft .NET 5 - Improved Detection

Postby Tinus » Thu Apr 22, 2021 12:03 pm

Thanks Franceso for confirming the issue,

in the meantime I played with .Net 6.0 preview 3. This adds additional problems because the version is not a number (and the conversion in IA fails). Please download the latest preview and repeat your tests:
https://dotnet.microsoft.com/download/d ... 4-binaries

Regards
Martin
Martin Rothschink
InstallAware MVP

AxoNet Software GmbH
http://www.axonet.de/products/other-pro ... stallaware

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: Microsoft .NET 5 - Improved Detection

Postby FrancescoT » Thu Apr 22, 2021 1:26 pm

Thanks for letting me know.

I did this test already and the fixed scripts don't present any problem with or without ".Net 6.0 preview 3".

Multiple versions of "ASP.Net Core" can coexist, and due of this, in our case it's just necessary to check if any of the version 5.x.x is already installed or not.
dotnet_info.png
dotnet_info.png (20.84 KiB) Viewed 14059 times
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Sample Scripts”

Who is online

Users browsing this forum: No registered users and 25 guests