kotlinandroid-jetpack-composekotlin-multiplatformcompose-multiplatformcompose-desktop

How to create MSI file with Compose Desktop


I'm trying to generate a .MSI file with my Compose Desktop app in Android Studio.

I have this gradle:

compose.desktop {
    application {
        mainClass = "com.helper.MainKt"

        buildTypes.release.proguard {
            obfuscate.set(true)
        }

        nativeDistributions {
            targetFormats(TargetFormat.Msi, TargetFormat.Exe)
            packageName = "Helper"
            packageVersion = "1.0.0"
        }
    }
}

When I execute .\gradlew createDistributable only a folder with the .exe file is created, but I can't find any .msi file anywhere. I also tried removing TargetFormat.Exe and letting only TargetFormat.Msi with same result.


Solution

  • Found the solution.

    .\gradlew createDistributable was creating just the executable without installer.

    If you want an installer (exe or msi) you must use these commands:

    .\gradlew packageDistributionForCurrentOS (just installer)

    .\gradlew packageReleaseDistributionForCurrentOS (installer with proguard enabled)