LeanCOST ClickOnce update (MsSQL database)
This guide describes how to update LeanCOST ClickOnce both server-side and client-side, with database on MsSQL.
1. Introduction
To update LeanCOST you’ll need to download some files from a few links: you shall check for each “.zip” file you download that it does not have a security block and eventually disable it, by applying the following procedure:
- Right-click with the mouse on the downloaded “.zip” file
- Select “Properties” option in the context menu which will open and then go to the tab named “General”.
If the “.zip” file is blocked, you will see the button or the box “Unblock”. In this case:
- Press “Unblock” button or tick “Unblock”.
- Press “Ok” to save the changes.

2. Server-side procedure
Server-side you need to update the “LeanCOSTDB” database and the ClickOnce Deploy folder.
2.1 Database update
The following procedure must be applied on the MsSQL instance that stores the “LeanCOSTDB” database in use to update it with the one you downloaded from the link sent by Hyperlean.
Database backup
First of all it is necessary to backup the database that is in use.
Log-in the instance where the “LeanCOSTDB” database is stored and open the “Databases” node. In the databases tree, select the database named “LeanCOSTDB” and right click on it: in the context menu that will appear, select the voice “Tasks” and, then, in the second menu which will open after this selection, choose “Back Up”.

The “Back Up Database” window will open, here:
- Choose “Full” as”Backup Type”
- Click the “Remove” button to delete the default destination folder
- Click “Add…” to choose where to save the new file.

Press the “….” button in the next window, to choose the destination path where the backup file will be saved.

After choosing the path, type the new file name, followed by the “.bak” extension.

You’ll be redirected to the backup window: here press “Ok” and the backup will start.

Once the backup is done, you’ll recieve this message.

Database restore
Once you backed up the current database, it’s possible to update it by restoring the “.bak” file sent by Hyperlean support.
Log-in the instance where the “LeanCOSTDB” database is stored and open the “Databases” node. In the databases tree, select the database named “LeanCOSTDB” and right click on it then select “Tasks” -> “Restore” -> “Database…” in the context menus.

The “Restore Database” window wil open: here follow the steps shown in the next picture.

Once pressed “OK” at step 6 of the previous image, the path of the file “LeanCOSTDB.bak” to restore will appear in the “Select backup devides” window: here press “OK” to go on with the restoration.

After having pressed “OK” you’ll be redirected to the “Restore database” window.
If you want to change the path where the data and log files will be savedelect “Files” in the left menu, check “Relocate all files to folder” and type the desired path in the “Data file folder” and “Log file folder” textboxes.
Make sure the paths are correct in the “Restore As” column.

Now, select “Options” in left menu and select “Overwrite the existing database (WITH REPLACE)” option and, finally, press “OK” button to start the restoration.

Once the restoration procedure has been completed, you’ll recieve this message meaning that the database was updated.

Setting the “db_owner” user
To let LeanCOST open successfully with the updated database, it is necessary to check that the user created for the LeanCOST database (usually named “leanuser”) is “db_owner” of the “LeanCOSTDB” database.
Open “Security” node in the SQL instance where the LeanCOST database is stored. Open the subnode named “Logins”: here there will be the user created for LeanCOST database (suggested name = “leanuser”).
Select the user created for LeanCOST database, right click on it and select “Properties” voice in the context menu.

The “Login Properties” window will appear: select “User Mapping” on the left.
Then, select “LeanCOSTDB” database under the “User mapped to this login” table. Finally, check that “db_owner” is flagged. If it is not, select it and press “OK”.

2.2 ClickOnce update
Apply the following procedure on the server you chose for ClickOnce deployment to update LeanCOST used by final users.
Open folder “…\LeanCOST\LeanCOST_Deploy\ClickOnce”.
Delete evrything that is inside the “ClickOnce” folder except for “Application Files”.

Download the “LeanCOST_xx.x.x_ClickOnce.zip” from the link Hyperlean sent and unzip it on desktop.
Copy the whole content of the unzipped folder “LeanCOST_xx.x.x_ClickOnce” and paste it inside the “…\LeanCOST\LeanCOST_Deploy\ClickOnce” folder and overwrite the folder “Application Files”.
Open the folder “…\LeanCOST\LeanCOST_Deploy\Settings” and run the the “Change_LeanCOST_distribution.bat” file by double-clicking on it.

3. Client-side update
On every client PC where LeanCOST is installed, the automatic download of the new update wil begin as soon as it is launched by its desktop icon.

Once the download has ended, the login window of LeanCOST will open: Select language, type your username and password, then click “Ok”.

Wait for the LeanCOST interface to open.
If LeanCOST has the CAD import enabled, we suggest you test this feature right after the update.
If you run into any problems, contact support@hyperlean.eu.