# How to Publish your Flutter App on Windows - The Easy Way

As you maybe already know, [the flutter's 2.0 stable channel already integrates the feature of building apps for desktop](https://flutter.dev/desktop#beta-snapshot-in-stable-channel), but **it stills in beta**, you have to consider that.

In this post, I'm going to show you how to generate the build for Windows and create an installer for your end-user to make his installation process easy as possible.

## What do you need before starting?

You only need two things installed in your system:
- Flutter
- Visual Studio 2019 with the “Desktop development with C++” workload installed, including all of its default components
- InnoSetup

The installation of Flutter and Visual Studio won't be explained because it's beyond the scope of this post, but I'll show you the installation of **InnoSetup** because we are going to create the installer with it.

## InnoSetup Installation

1. First access the [InnoSetup's website](https://jrsoftware.org/isdl.php#qsp).
1. Then find this section and select a link in the *Download Sites* column:
![Screenshot 2021-04-22 174452.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619131513947/gg-yLIk0p.png)

1. Execute the `innosetup-x.y.z.exe` file, as you can see is the classic installation process:

![is1.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619131791940/AKkpEwtkI.png)

![is2.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619131801757/N2OA76OFx.png)

![is3.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619131821078/LTYxQpELo.png)

Congrats! You have InnoSetup installed! 🥳

## Creating the App

First, you need to enable the desktop environment in flutter by writing the following in PowerShell:

```bash
PS > flutter config --enable-windows-desktop
```

After that you can check the connected devices by executing `flutter devices`, you should see Windows (desktop) in the list:

```bash
PS > flutter devices
1 connected device:

Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.18362.1082]
...
```
If you have problems you can execute `flutter doctor` to see what's wrong, but you should see something like this:

```bash
PS > flutter doctor                                                                     
Doctor summary (to see all details, run flutter doctor -v):                                           
[√] Flutter (Channel beta, 1.27.0-1.0.pre, on Microsoft Windows [Version 10.0.19042.782], locale en-AU)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)                      
[√] Chrome - develop for the web                                                                      
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.7)                         
[√] Android Studio (version 4.1.0)                                                                    
[√] VS Code (version 1.51.1)                                                                          
[√] Connected device (3 available)                                                                    
```

If everything is ok, you can create a new project:
```bash
PS > flutter create windowsapp
```

Then go to the directory:
```bash
PS > cd windowsapp
```

And execute the app 🤩:

```bash
PS > flutter run -d windows
```

Great you are running a flutter app on Windows 🥳🎊🎉!!!

![f.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619133547691/w4xjdUMJn.png)

## Build a Release App

As easy as running a single command 🥰:

```bash
PS > flutter build windows
```
The build is located in `build\windows\runner\Release\`:

![release.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619135437238/wMDOk4LGY.png)

## Distributing the App

Now comes the interesting part and the hardest one, this is because you need to put some `.dll` files **manually** (🤮) and create your own installer.

So, you need to place 3 `.dll` files in the build folder, which are:

- msvcp140.dll
- vcruntime140.dll
- vcruntime140_1.dll

You must find them in the directory `C:\Windows\System32`. After you place these 3 files your build directory must look like this:

![dlls.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619137031575/CtuDSckve.png)

### Creating the Installer

- Create a folder called `installer` inside the build folder.
- Open InnoSetup and click the first button:

![isc1.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1619137884473/992tHh4nN.png)

- Then click on next:

![isc2.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619138039354/AD6MjD1Ei.png)

- Then write your data and click next:

![Screenshot 2021-04-22 193447.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619138130326/KE_h37phd.png)

- You can change the folder settings as you wish, then click on next:

![isc3.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619138264253/JXQOS0ZXV.png)

- This is the most important step, you have to click the `Browse...` button and select the `.exe` file, then click the `Add Folder...` button and select the `Release` folder (`build\windows\runner\Release\`) which is the build folder, finally it will appear a message saying "Should files in subfolders also be included?" you must click `Yes` and then click on next:

![isc5.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619138590789/alEfoYW1-.png)

- Depending on your needs you should disable this section:

![isc6.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619139036276/a519uwsjU.png)

- You can customize this section also:

![isc7.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619139116520/YiQw9UZuS.png)

- Here you can attach your license and some other information:

![isc8.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619139229624/vLIuFCUcv.png)

- Then you can choose the installation method:

![isc9.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619139320664/rfUqBFw81.png)

- Select the languages that you need for your installer:

![isc10.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619139377370/LWM-i2lFO.png)

- Select the `installer` folder that we created. and the name of the file, you can add a custom icon and password:

![isc11.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619139531488/Ko24XUL8_.png)

- Click next:

![isc12.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619139566246/6BRXwyP-w.png)

- Finally, click `Finish` and `Yes`

![isc13.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619139645540/Qe6F9n2o6.png)


![isc14.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619139650173/_X3C64kTg.png)

It will also ask you if you want to save the script, you can choose no if you want.

## Installing Our App 🙂

Finally, after a few seconds, you will see the installer in the `installer` folder:

![ins.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619140408634/y9X3EG0iK.png)

Open the installer and you'll see a classic installation process, you just have to click next until is installed.

And BOOM 🤯, you got a successful installation of a Flutter App on Windows 🥰

![fin.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1619140855598/iSB5CUivk.png)

Hope you enjoyed this tutorial, see you next time 🤗
