Page 1 of 1

[SOLVED] Solidworks 2024 Package

Published: June 3, 2024 - 09:39
by gaelds
Good morning,
I'm having a strange problem with my Solidworks 2024 package. It installs correctly and uninstalls as well. But if I try to reinstall it on the same PC, it only "pretends" to install. The package's install() function doesn't return an error (auditing is disabled), but nothing actually reinstalls. If I run a manual installation of the same version of Solidworks, it installs correctly on the machine.

Here is the setup.py file:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
app_name = 'SOLIDWORKS 2024'
app_dir = makepath(programfiles, 'SOLIDWORKS Corp')
app_dir_binaries = makepath(app_dir,'SOLIDWORKS')
binary_name = "SLDWORKS.exe"
kill_list = [binary_name]

def install():
    print('Installation de : %s' % control.name)
    install_exe_if_needed(r'SW2024\startswinstall.exe',silentflags='/install /now',timeout=1800)

def uninstall():
    # Remove software and all dependances installed by my custom Administrative SolidWorks Image. You should probably adapt this function to your Administrative Image.
    print('Uninstalling CEF for SOLIDWORKS Applications')
    run_notfatal(r'MsiExec.exe /X{A3731044-38ED-44A1-AA43-0819B422AADB} /passive /norestart') 
    print('Uninstalling SOLIDWORKS 2024 French Resources')
    run_notfatal(r'MsiExec.exe /X{12E5ACE4-6D44-444C-BCA4-679A861D0711} /passive /norestart') 
    print('Uninstalling SOLIDWORKS eDrawings 2024 SP02.1')
    run_notfatal(r'MsiExec.exe /X{3835B6E2-CC35-4F45-900A-5AE9772B8B24} /passive /norestart') 
    print('Uninstalling SOLIDWORKS Flow Simulation 2024 SP02.1')
    run_notfatal(r'MsiExec.exe /X{5D202678-5697-45BE-B4DF-3208EBFE8415} /passive /norestart') 
    print(r'Desinstallation de SOLIDWORKS 2024 SP02.1')
    run_notfatal(r'MsiExec.exe /X{E9661DF2-E1B0-423F-BFFA-1A6EF0B1307B} /passive /norestart') 
    print(r'Uninstalling SolidWorks Installation Manager 20240-40200-1100-100')
    run_notfatal(r'"C:\WINDOWS\SolidWorks\IM_20240-40200-1100-100\sldim\sldim.exe" /remove "C:\WINDOWS\SolidWorks\IM_20240-40200-1100-100\sldim\sldIM_installed.xml"') 
    if reg_key_exists(HKEY_LOCAL_MACHINE,r'SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\SolidWorks Installation Manager 20240-40200-1100-100'):
        registry_deletekey(HKEY_LOCAL_MACHINE,r'SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall',r'SolidWorks Installation Manager 20240-40200-1100-100')
        remove_tree(r'C:\Windows\Solidworks')
    print(r'Remove extra folders and data')
    remove_tree(r'C:\Program Files\SOLIDWORKS Corp')
    remove_tree(r'C:\SOLIDWORKS Data')
    remove_tree(r'C:\ProgramData\SOLIDWORKS')
    remove_tree(r'C:\Windows\Solidworks')

def audit():
    return("OK")
On the second installation (after uninstallation), it correctly displays "Installing: SW2024\startswinstall.exe (32.2.0.115)", not indicating that this version of the software is already present. Uninstalling the package leaves no trace in Windows' "Programs and Features".

EDIT: I think the problem stems from the missing "SW2024\64bit\sldim\admin.dat" file, which I removed from the package because it was causing a SHA not matching error (antivirus detection?). It should be recreated in the SW2024 folder just before installation.

Re: Solidworks 2024 Package

Published: June 3, 2024 - 11:50 AM
by gaelds
The package works by creating the SW2024/64bit/sldim/admin.dat file on the fly just before installation:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
app_name = 'SOLIDWORKS 2024'
app_dir = makepath(programfiles, 'SOLIDWORKS Corp')
app_dir_binaries = makepath(app_dir,'SOLIDWORKS')
binary_name = "SLDWORKS.exe"
kill_list = [binary_name]

def create_admin_dat_file():
    # Définir le contenu du fichier
    file_content = """// SolidWorks Installation Manager Admin Image Marker File - DO NOT DELETE OR MODIFY!
Release = 20240-40200-1100-100
Status = 2
<End>"""
    
    # Définir le chemin du fichier
    directory = "./SW2024/64bit/sldim"
    file_path = os.path.join(directory, "admin.dat")
    # Créer le dossier si nécessaire
    os.makedirs(directory, exist_ok=True)
    # Écrire le contenu dans le fichier
    with open(file_path, "w") as file:
        file.write(file_content)
    print(f"Fichier créé : {file_path}")

def install():
    # Création du fichier admin.dat
    create_admin_dat_file()
    print('Installation de : %s' % control.name)
    install_exe_if_needed(r'SW2024\startswinstall.exe',silentflags='/install /now',timeout=1800)

def uninstall():
    # Remove software and all dependances installed by my custom Administrative SolidWorks Image. You should probably adapt this function to your Administrative Image.
    print('Uninstalling CEF for SOLIDWORKS Applications')
    run_notfatal(r'MsiExec.exe /X{A3731044-38ED-44A1-AA43-0819B422AADB} /passive /norestart') 
    print('Uninstalling SOLIDWORKS 2024 French Resources')
    run_notfatal(r'MsiExec.exe /X{12E5ACE4-6D44-444C-BCA4-679A861D0711} /passive /norestart') 
    print('Uninstalling SOLIDWORKS eDrawings 2024 SP02.1')
    run_notfatal(r'MsiExec.exe /X{3835B6E2-CC35-4F45-900A-5AE9772B8B24} /passive /norestart') 
    print('Uninstalling SOLIDWORKS Flow Simulation 2024 SP02.1')
    run_notfatal(r'MsiExec.exe /X{5D202678-5697-45BE-B4DF-3208EBFE8415} /passive /norestart') 
    print(r'Desinstallation de SOLIDWORKS 2024 SP02.1')
    run_notfatal(r'MsiExec.exe /X{E9661DF2-E1B0-423F-BFFA-1A6EF0B1307B} /passive /norestart') 
    print(r'Uninstalling SolidWorks Installation Manager 20240-40200-1100-100')
    run_notfatal(r'"C:\WINDOWS\SolidWorks\IM_20240-40200-1100-100\sldim\sldim.exe" /remove "C:\WINDOWS\SolidWorks\IM_20240-40200-1100-100\sldim\sldIM_installed.xml"') 
    if reg_key_exists(HKEY_LOCAL_MACHINE,r'SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\SolidWorks Installation Manager 20240-40200-1100-100'):
        registry_deletekey(HKEY_LOCAL_MACHINE,r'SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall',r'SolidWorks Installation Manager 20240-40200-1100-100')
        remove_tree(r'C:\Windows\Solidworks')

    print(r'Remove extra folders and data')
    remove_tree(r'C:\Program Files\SOLIDWORKS Corp')
    remove_tree(r'C:\SOLIDWORKS Data')
    remove_tree(r'C:\ProgramData\SOLIDWORKS')
    remove_tree(r'C:\Windows\Solidworks')

def audit():
    if isfile(makepath(app_dir_binaries,binary_name)):
        return("OK")
    else:
        return("Erreur : %s est introuvable !" %binary_name)

Re: Solidworks 2024 Package

Published: June 13, 2024 - 11:31
by dcardon
Hi Gaël,

thanks for the feedback. :-) I'm marking this topic as resolved. We'll look into adding a SolidWorks package to the store.

Denis