User Tag List

Results 1 to 7 of 7

Thread: Need a way to check .net core version installed and offer to install it if it isn't

  1. #1
    Clicker Install Creator Pro

    Join Date
    Jul 2008
    Location
    UK
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Need a way to check .net core version installed and offer to install it if it isn't

    Hi all,

    Is there a way to check what version of .net core is installed? And if it isn't, a way to offer to install it?

    How would you do this if there is a way?

    Thank you in advance for any aid

    It is for this software: Mod Studio 2. See Troubleshooting steps for specific versions of .net.

  2. #2
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    1,999
    Mentioned
    25 Post(s)
    Tagged
    0 Thread(s)
    Run the command "C:\Program Files\dotnet\dotnet.exe" --list-runtimes and capture the output, maybe in Console object or Pipe object, or by writing a simple batch file that outputs to text document and running it. See here for more specifics.

  3. #3
    Clicker Install Creator Pro

    Join Date
    Jul 2008
    Location
    UK
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post

    Quote Originally Posted by Phi View Post
    Run the command "C:\Program Files\dotnet\dotnet.exe" --list-runtimes and capture the output, maybe in Console object or Pipe object, or by writing a simple batch file that outputs to text document and running it. See here for more specifics.
    I much appreciate the reply, so huge thank you!

    Sadly, I'm no good at writing batch files so put up a help request on stackoverflow which got deleted - so much for asking for help.

    I found batch file code on stackoverflow that someone had put up which runs at the end of the installation but it only works on 64 bit due to the reg key it looks up. So for 32 bit systems, it will always assume they don't have it installed:

    But it works.

    Code:
    @echo offTitle Mod Studio 2 .NET Core Check
    :: Check for .Net Core v3.1
    echo:
    echo Checking your computer for .Net Core v3.1 which is required by Mod Studio 2 ...
    echo:
    
    
    setlocal enabledelayedexpansion
    set g_strInternalOutputFullFilename=%TEMP%\MS2netcorecheck.log
    
    
    REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\x64\sharedfx\Microsoft.NETCore.App" /s|FIND "3.1" > "!g_strInternalOutputFullFilename!"
    IF %ErrorLevel% EQU 0 (
        echo .Net Core v3.1 is already installed.
    	echo:
    	echo Please press any key to close this window.
    	echo:
    	pause >nul
    	Goto :SkipDotNet
    ) else (
        echo .Net Core v3.1 is NOT installed.
        echo:
        echo Please download and install .Net Core v3.1 now ...
    	echo:
    	echo Please do not click on the close button as this will not load the download page.
    	echo:
    	echo To be taken to the .Net Core v3.1 download page now, please press any key.
    	echo:
    	pause
    )
    ::Install .Net Core v3.1
    Start "" https://dotnet.microsoft.com/download/dotnet-core/thank-you/runtime-desktop-3.1.3-windows-x64-installer
    :SkipDotNet
    It would be better to have a script which:


    1. runs the command "dotnet --list-runtimes"
    2. checks through the results to see if "Microsoft.NETCore.App 3.1" is installed - maybe store them in a temp output.text file (%TEMP%\dotnetcorecheck.log and use FIND?)
    3. If it isn't present on a users system, then go to download url (https://dotnet.microsoft.com/downloa...-x64-installer)
    4. Otherwise informs user they already have it installed.

  4. #4
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    1,999
    Mentioned
    25 Post(s)
    Tagged
    0 Thread(s)
    To write from batch to a file, use
    echo Installed > output.txt
    The > output means the standard output lines (as opposed to standard error, 2>) will go to the text file.
    The dotnet list--runtimes could work if you output it with >, then use FIND/FINDSTR.

    Alternatively, as seen in the REG line, you can pass the results directly to FIND/FINDSTR with the | operator.
    Program1 | Program2
    ...means Program2 will get Program1's output as Program2's input.

  5. #5
    Clicker Install Creator Pro

    Join Date
    Jul 2008
    Location
    UK
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. I'll have a gander and have a go at that myself using the site (https://ss64.com/nt/) for aid - when I can find time.

  6. #6
    Clicker Install Creator Pro

    Join Date
    Jul 2008
    Location
    UK
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Quote Originally Posted by Phi View Post
    To write from batch to a file, use
    echo Installed > output.txt
    The > output means the standard output lines (as opposed to standard error, 2>) will go to the text file.
    The dotnet list--runtimes could work if you output it with >, then use FIND/FINDSTR.

    Alternatively, as seen in the REG line, you can pass the results directly to FIND/FINDSTR with the | operator.
    Program1 | Program2
    ...means Program2 will get Program1's output as Program2's input.
    Thank you Phi.

    I have managed to accomplish the checking on net core using the dotnet --list-runtimes command instead of registry key

    If anyone else wants the code, here it is:
    Code:
    @echo off
    Title Mod Studio 2 .NET Core Check
    :: Check for .Net Core v3.1
    echo:
    echo Checking your computer for .Net Core v3.1 which is required by Mod Studio 2 ...
    echo:
    
    
    setlocal enabledelayedexpansion
    set OutputFilename=%TEMP%\MS2netcorecheck.log
    
    
    :: Send dotnet results to output log file and find relevant core version
    dotnet --list-runtimes | FIND "Microsoft.NETCore.App 3.1" > "!OutputFilename!"
    :: If search result is positive then ...
    IF %ErrorLevel% EQU 0 (
        DEL /F /Q %TEMP%\MS2netcorecheck.log
        @dotnet --list-runtimes > "!OutputFilename!"
        echo .Net Core v3.1 is already installed; therefore you do not need to download it.
        echo:
        echo Please press any key to close this window.
        echo:
        pause >nul
        Goto :SkipDotNet
    ) else (
        DEL /F /Q %TEMP%\MS2netcorecheck.log
        @dotnet --list-runtimes > "!OutputFilename!"
        echo .Net Core v3.1 is NOT installed.
        echo:
        echo Please download and install .Net Core v3.1 now ...
        echo:
        echo Please do NOT click on the close button as this will not load the download page.
        echo:
        echo To be taken to the .Net Core v3.1 download page now, please press any key.
        echo:
        pause
    )
    ::Install .Net Core v3.1
    Start "" https://dotnet.microsoft.com/download/dotnet-core/thank-you/runtime-desktop-3.1.3-windows-x64-installer
    :SkipDotNet

  7. #7
    Clicker Install Creator Pro

    Join Date
    Jul 2008
    Location
    UK
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So it seems the code above doesn't work correctly if the user doesn't have .net installed. However the following edits allow it to work fully:

    I fixed it by adding the following before the 1st "dotnet --list-runtimes":

    WHERE dotnet >nul 2>&1
    IF %ERRORLEVEL% NEQ 0 (
    Goto :InstallDotNet
    )
    :: Send dotnet results to output log file and find relevant core version
    dotnet --list-runtimes | find /i "Microsoft.WindowsDesktop.App 5" | find /i /V "-rc" >nul 2>&1
    :: If search result is positive then ...
    IF %ErrorLevel% EQU 0 (
    ) else (
    DEL /F /Q %TEMP%\MS2netcorecheck.log
    @dotnet --list-runtimes > "!OutputFilename!"
    Goto :InstallDotNet
    )
    ::Install .Net Core v5
    :InstallDotNet
    pause
    Start ""
    :SkipDotNet

Similar Threads

  1. Rocket Core is on Greenlight! Please check it out!
    By chrisperry1983 in forum WIP & Released Games & Apps
    Replies: 10
    Last Post: 22nd May 2017, 06:58 PM
  2. Check if App is installed or enabled
    By AlanRuno in forum Android Export Module 2.5
    Replies: 3
    Last Post: 4th May 2017, 10:20 PM
  3. Patch Maker - If Installed, Install it
    By cmiller in forum Install Creator and Patch Maker
    Replies: 0
    Last Post: 9th January 2015, 03:38 PM
  4. "Do Not Install If Later Version is Installed" feature. No warning, files installed.
    By TheDonald in forum Install Creator and Patch Maker
    Replies: 8
    Last Post: 1st August 2013, 06:40 PM
  5. Check if user has DirectX 9.0 installed?
    By edkeyte in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 8th November 2008, 01:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •