Electron - build an installer for Windows x64 on Mac - electron

I am new to electron and trying to build a windows installer for the electron app using my mac. I am using electron-packager to package the app and then electron-wix-msi to build the installer. When the build installer steps are executed, the error Unable to read file info from exe. Falling back to packaging description. Error: spawn Unknown system error -86 is thrown. please see the full error message in the attached screenshot.
I would like to highlight that when I build an installer for macOS, it works. Should I understand that I can not build a windows installer using mac?
build_installer64.ts file:

You can't do that, you have to do this on the Windows platform.
I use GitHub Actions to build my app for each platform, code for Windows:
https://code.korbsstudio.com/KorbsStudio/electron-builder-sample/-/blob/main/.github/workflows/build.yml#L52-71
Optionally, you can also use a Windows virtual machine and repeat the same process in there.
Update, for those interested in doing this on Linux, building a EXE setup file seems to be possible. You'll need to have wine installed and use:
npx electron-builder build --win

Related

How to deliver a desktop app of Kotlin multiplatform project?

I don't see in documentations. When I build a multiplatform compose project based on JVM, how can I deliver a desktop package or app so others can execute it easily?
==========
Update:
I specified the following in build.gradle.kts under desktop
compose.desktop {
application {
mainClass = "MainKt"
javaHome = System.getenv("JDK_18")
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "MyApp"
packageVersion = "1.0.0"
}
}
}
Then running ./gradlew packageDeb (on Ubuntu) I got a .deb package, which I could install on Ubuntu and run. Very cool. (It looks there is no option building it from Intellij and I have to do it with gradlew)
Then I tried ./gradlew packageMsi, it came back very quickly saying build successful, but I get no .msi file generated. Do I have to build it from a Windows machine?
I haven't tried to build the dmg for Mac as it's advised to use XCode on the Mac to generate a signed version.
==============
Update 1:
So based on description of jPackage from Oracle:
Application packages must be built on the target platform. The system
used for packaging must contain the application, a JDK, and software
needed by the packaging tool.
To package your application for multiple platforms, you must run the
packaging tool on each platform. If you want more than one format for
a platform, you must run the tool once for each format.

VS Code-'dart' is not recognized as an internal or external command, operable program or batch file

I am trying to install flutter and run the basic flutter example on visual studio code . I used flutter doctor in the command line and installed all the missing requirements , now i try to run a basic program in flutter ,but in visual studio code output i get the following error
[Running] dart "c:\fluttercode\mobile_test1\lib\main.dart"
'dart' is not recognized as an internal or external command,
operable program or batch file.
[Done] exited with code=1 in 64.965 seconds
I could find only one question similar to this in stack overflow ,
Visual Studio Code: dart not found
they told to change environment variables ,i added the environment variables (however the name of the environment variables was not mentioned in the answer )
I checked the dart site in case they mentioned it ,but i couldn't find anything related to the name of the environment variable
This is what i got from dart site
Windows:
In Windows, setting your PATH and environment variables can be done by opening Control Panel and typing “Environment” and then clicking the “Edit the system environment variables” option. You’ll be presented with a list of environment variables including PATH where you can edit or add new ones.
Note: You should reboot your computer after making changes to PATH to ensure all processes (including explorer) are updated.
So i just did a guess and added an environment variable with the name FLUTTER_ROOT(cause i remember reading somewhere in one of the settings in VS Code for dart ,this name was used) and pointed it to my flutter bin directory
I restarted my PC and opened vs code and changed in VS Settings >user settings>dart and flutter>Dart:Env and updated my path
{
"files.autoSave": "afterDelay",
"dart.flutterSdkPath": "C:\\src\\flutter\\bin"
}
But i get the same error
this is how my flutter bin folder looks like
Environment variables in PATH after installing Dart
You don't have to install the dart SDK if you already have the flutter SDK installed. When you specify the path of flutter, VSCode only recognizes the flutter commands and not the dart commands. What you should do is change the system environment variables (type env in the windows search bar) and add the dart sdk inside the PATH variable. The dart sdk is usually found inside /bin/cache/dart/bin. This worked for me, so give it a try
Try to add the flutter\bin sdk path and also the windows\system32 path to the user variables and/or system variables.
I had the same problem. Here is how I resolved it.
Download and extract dart sdk (I used the stable release)
https://v1-dartlang-org.firebaseapp.com/install/archive
add the dart sdk bin folder to your path
after you have added it to your path run
flutter pub global activate webdev
now i can run
webdev serve
without error.
I'm using windows so I used choco install dart-sdk -<version> to install dart through the powershell in admin mode. That got rid of my error
Installing flutter is not enough. You need to install the dart sdk.
Pre-req: Make sure you have Chocolatey installed on your machine.
Run "choco install dart-sdk" from an elevated prompt.
Restart vscode.
That did it for me.
I went to the dart website and searched for the dart sdk.
i then chose the option to install dart using setup wizard.
After running the executable file on my laptop it took some time to download all the files but once the setup was complete the error no longer occurred and i was able to run the code successfully.
Downloading dart setup from dart website
Installing using setup wizard

How to setup android ndk in jenkins on linux

I have jenkins on ubuntu. Building worked fine until I started to use android ndk.
latest ndk is downloaded and extracted into /opt/android-sdk-linux/ndk-bundle
In /etc/profile.d/android.sh is:
export ANDROID_HOME="/opt/android-sdk-linux"
export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH"
export ANDROID_NDK_HOME="/opt/android-sdk-linux/ndk-bundle"
but I got still error:
:common:compileDebugNdk FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':common:compileDebugNdk'.
NDK not configured.
Download the NDK from http://developer.android.com/tools/sdk/ndk/. Then add ndk.dir=path/to/ndk in local.properties.
(On Windows, make sure you escape backslashes, e.g. C:\ndk rather than C:\ndk)
The message says it all. You should add a text file local.properties to the project directory on the Linux machine, with one line
ndk.dir=/opt/android-sdk-linux/ndk-bundle
This file is usually in .gitignore, and Android Studio generates it automatically. But when you build your project in Jenkins, it does not open Android Studio.

mdtool creates IPA file when using release but not when using debug configuration

I want to create an IPA file for both the release and debug for my app created in xamarin. I created the release IPA file with the following command in Bamboo:
-v build -t:Build "-c:Release|iPhone" CustomerApp.sln
This can be replicated on the terminal too by doing this:
/path-to-/mdtool -v build -t:Build "-c:Release|iPhone" CustomerApp.sln
But when I try to use the "-c:Debug|iPhone" this will not create the ipa file, when trying to use the terminal or Bamboo. I then tried different configurations like "-c:Release|iPhoneSimulator", "-c:Debug|iPhoneSimulator", "-c:Ad Hoc|iPhone" and "-c:Debug|iPhoneSimulator" but all of these will not create the IPA file. Why is this?
I know that the path to mdtool and the solution are fine because it works for the Release IPA but is it to do with the configuration in either Xamarin or Xcode?
If you are on the same Mac as the one you are running Xamarin Studio, it should mimic the provisioning profile setup you have in the IDE. If the build in Xamarin Studio builds with that combination with no drop down change on the main project, I would expect the mdtool to work. Note that now in Visual Studio 2017 for Mac it will be vstool under the /Applications/Visual Studio.app folder.
My build line looks like this:
/Applications/Visual\ Studio.app/Contents/MacOS/vstool --verbose build --f --target:Build --configuration:"Debug|iPhone" --buildfile:my.sln > $BuildResults
Update January 2019, I have found very little guidance on the web about what exactly vstool can do and how to use it. I believe it to be the Microsoft version of the mdtool, which is part of the Monodevelop project at Github (mono/monodevelop). The mdtool source code is under monodevelop/main/src/tools folder. It appears to be a runner for a variety of tools available in the Monodevelop / Visual Studio installation. Running
/Applications/Visual\ Studio.app/Contents/MacOS/vstool -q
will list out the available tools. There is also a man page as part of the Monodevelop build process, at monodevelop/main/man which provides a bit more enlightenment. I was shown how to use the specific command by someone who was very familiar with the project.

Command line for "x64 checked build environment"

I have installed WDK and SDK on my Pc.. I can see them on my system.. But I am not able to get "x64 checked build environment command prompt"..My OS is windows 8.1 .. If anyone has a solution to the problem please do let me know
If you open a VS developer prompt, you should have access to MSBUILD and from there, you need to use MSBuild command line parameters to build for x64 chk project. These variables would be /p:platform=x64 and /p:configuration=Win7 Debug. WDK will pick the right cross arch compiler and build for the respective configuration.

Resources