[SOLVED] Solidworks 2024 Package

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

June 3, 2024 - 09:39

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.
Gaelds
Messages: 254
Registration: Nov 22, 2015 - 08:37

June 3, 2024 - 11:50

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)
User avatar
dcardon
WAPT Expert
Messages: 1930
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

June 13, 2024 - 11:31

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
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Locked