Electronic electron-winstaller Install installation path for Msi

I use Electron and Angular2 to create a desktop application for Windows and can successfully generate .exe and .msi files for installation. I use an electronic packer to pack my electronic application a packaged electronic application

After packing the application, I use electronic-winstaller to generate msi from the package

When I run the .msi file, it automatically sets my project to C: \ Users \ Username \ AppData \ Local \ ApplicationName. The only thing when double-clicking on msi is a short dialog: dialogue

However, I would like the installer to ask me where he should install the application. I want to be able to set the installation path during installation.

It should also be mentioned that I tried to use an electronic builder and could also generate a msi file. But here I also could not establish the installation path. I found this Electron by creating an MSI installer using electronic build where someone had the same problem with an electronic developer, but there was no answer to his question.

Here is my configuration for electronic winstaller. The winstaller.js file is located in the root of my project:

var electronInstaller = require('electron-winstaller'); var resultPromise = electronInstaller.createWindowsInstaller( { appDirectory: '../installer/sda-win32-x64', outputDirectory: '../installer', authors: 'SORA Desktop Application', exe: 'sda.exe', setupExe: 'SDASetup.exe', setupMsi: 'SDASetup.msi', iconUrl: 'file:///d/dev/sda/client/src/app/assets/images/icon.ico', setupIcon: 'src/app/assets/images/icon.ico' }); resultPromise.then(() => console.log('It worked!'), e => console.log(`No dice: ${e.message}`)); 

Here is my package.json configuration. This is also at the root of my project.

 { "name": "sda", "description": "SDA 3.0", "version": "0.0.1", "main": "gulpfile.js", "keywords": [ "Angular", "Angular2", "Electron", "Typescript" ], "author": "Vic", "license": "MIT", "scripts": { "build": "gulp build", "start": "npm run build && electron ./dist/index.js", "package": "npm run build && gulp electron:package", "postinstall": "concurrently \"bower install\" \"typings install\"", "appstart": "electron ./dist/index.js", "test": "gulp test", "deploy": "rm -rf ../installer && gulp setInDevelopmentFlagToFalse && cp src/app/environment/environment.prod.ts src/app/environment/environment.ts && npm run build && cd dist && electron-packager . --platform=win32 --arch=x64 --overwrite=true --out=../../installer --icon=assets/images/icon.ico && cd ../ && gulp setInDevelopmentFlagToTrue && cp src/app/environment/environment.dev.ts src/app/environment/environment.ts && node winstaller.js" }, "dependencies": { "@angular/common": "2.0.0", "@angular/compiler": "2.0.0", "@angular/core": "2.0.0", "@angular/forms": "2.0.0", "@angular/http": "2.0.0", "@angular/platform-browser": "2.0.0", "@angular/platform-browser-dynamic": "2.0.0", "@angular/router": "3.0.0", "@angular/upgrade": "2.0.0", "@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.8", "@types/hammerjs": "2.0.33", "@types/sjcl": "1.0.27", "angular2-jwt": "0.1.23", "angular2-moment": "1.0.0-beta.5", "angular2localization": "1.0.2", "bootstrap": "4.0.0-alpha.4", "core-js": "2.4.1", "file-saver": "1.3.3", "font-awesome": "4.6.3", "jquery": "3.1.1", "moment": "2.15.2", "normalize.css": "5.0.0", "reflect-metadata": "0.1.3", "rxjs": "5.0.0-beta.12", "sjcl": "1.0.6", "systemjs": "0.19.27", "tether": "1.3.7", "zone.js": "0.6.23" }, "devDependencies": { "bower": "1.7.9", "concurrently": "2.2.0", "del": "2.2.0", "electron": "1.3.5", "electron-connect": "0.6.0", "electron-packager": "8.1.0", "electron-prebuilt": "1.3.8", "electron-winstaller": "2.3.4", "eslint": "3.6.0", "eslint-config-google": "0.6.0", "eslint-plugin-html": "1.5.3", "gulp": "3.9.1", "gulp-atom-electron": "1.9.0", "gulp-concat": "2.6.0", "gulp-replace": "^0.5.4", "gulp-sass": "2.3.1", "gulp-shell": "0.5.2", "gulp-symdest": "1.0.0", "gulp-typescript": "3.0.2", "hammerjs": "2.0.8", "jasmine-core": "2.5.2", "karma": "1.3.0", "karma-chrome-launcher": "2.0.0", "karma-cli": "1.0.1", "karma-htmlfile-reporter": "0.3.4", "karma-jasmine": "1.0.2", "karma-jasmine-html-reporter": "0.2.2", "karma-sourcemap-loader": "0.3.7", "karma-typescript-preprocessor": "0.3.0", "run-sequence": "1.1.5", "typescript": "2.0.2", "typings": "1.3.2" } } 

Maybe I need a certificate? Isn't it the default for the Windows installer to ask where to install?

+6
source share
1 answer

electronic-winstaller uses squirrel to create configuration files. According to their documentation , the installation path is "effectively unchanged" and is hardcoded to \% LocalAppData% \ AppName

Set location

The Setup.exe file, and later the UpdateManager in MyApp, must have the ability to write files and execute files from the application to set the location. To provide permission for all types of users, the user application data directory is selected as the installation location (i.e.,% LocalAppData% \ MyApp).

The installation root really should consist of only two types: folders:

Packages - a folder used to download and build service pack files. Application folders are the “installed” application files for this version of MyApp. \% LocalAppData% \ MyApp \ packages MyApp-1.0.0.nupkg MyApp-1.0.1-delta.nupkg MyApp-1.0.1.nupkg \ app-1.0.0 MyApp.exe \ app-1.0.1 MyApp.exe The package directory is effectively unchanged , it simply consists of the packages we downloaded. Using a local application data directory means that we need entries to write to the installation directory for each user.

Tip. See “Extensive Settings” for more information about the application clicked by all users in a corporate environment.

The machine installation method is to use MSI, which only starts the installation the next time the user logs in:

System-wide installations

The Squirrel Releasify team creates an .msi file suitable for using Group Policy. This MSI is not a universal installer, which means that after starting MSI, users will then install the application the next time they log on.

Thus, for most ordinary users, you should continue to run the created Setup.exe according to Releaseasify, but if you want to have a version that is convenient for the IT administrator, you can transfer MSI

Most Squirrel users do not have to do anything new to enable this, although some NuGet package identifiers / names may have problems with MSI.

0
source

Source: https://habr.com/ru/post/1011804/


All Articles