Skip to content

[.NET] Distributing and Publishing your Moxo Web App

Ryan Walpole edited this page Mar 2, 2023 · 2 revisions

Distributing and Publishing your Moxo Web-App

Now that you've built and compiled your Moxo Web-App for .NET Framework and (possibly) made customisations within Visual Studio, you're ready to distribute and publish your app for the public.

Contents


Handling WebView2 Dependencies

Moxo QuickWeb applications for .NET use Microsoft's WebView2 technology in order to render and display web content - which is, in your case, your application's GUI, functions and features. In order to save on output space, we've decided to go with a method of distribution that assumes WebView2 is already installed on the target PC. Since your users might not have WebView2 installed, the application automatically checks for a WebView2 install during startup.

Within Program.cs:

try
{
    string WV = CoreWebView2Environment.GetAvailableBrowserVersionString();
    if (WV != null)
       {
             //WebView2 Version String was not null, therefore start program
             Application.Run(new Startup());
       }

    else
       {
             //WebView2 Version string was null or empty, therefore, WebView2 mustn't be installed
             MessageBox.Show("WebView2 is not installed on this system. For more information, visit https://github.com/RyanWalpoleEnterprises/Moxo-QuickWeb");
        }
}

Automatically Installing WebView2

You can automatically install WebView2 by including a copy of it within your application files and creating a first run setup.

ProcessStartInfo install = new ProcessStartInfo();
            install.FileName = DataFolder + "MicrosoftEdgeWebview2Setup.exe";
            install.Arguments = "/silent /install";
            install.WorkingDirectory = DataFolder;
            install.UseShellExecute = true;
            //install.RedirectStandardOutput = true;
            install.CreateNoWindow = true;
            Process.Start(install);

This code will automatically install Microsoft Edge WebView2 silently in the background. You can extend this by adding progress bars, and code to detect when the WebView2 installer finishes. You can learn more about distributing WebView2 apps, here.

Prompting the user to Install WebView2

You can alternatively edit the MessageBox to prompt the user to install WebView2 themselves. For example, you might replace the Informational MessageBox with a DialogResult MessageBox:

DialogResult result = MessageBox.Show(
"This application requires WebView2 to be installed in order to work. Would you like to download and install WebView2?",
"My App Name",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);

if(result == DialogResult.Yes){
    Process.Start("https://go.microsoft.com/fwlink/p/?LinkId=2124703");
}
else{
    Application.Exit();
}

This will allow the user to download and install Microsoft Edge WebView2, returning to your application once the installation is complete. They'll never have to update WebView2 or install it again for any future applications.

Creating a Setup Executable

The next step in distributing your application is to create a setup executable that guides the user through the installation process. You may be familiar with this if you've ever installed software on Windows before. They are often referred to as an Installation Wizard. For this step, we are going to run you through using InnoSetup. InnoSetup is a free install script program that allows you to easily create a setup executable using a wizard.

Step-by-Step Guide:

  1. Download and open InnoSetup.
  2. Click "Create a new script file using the Script Wizard" and click OK

image

  1. Fill out your application information including name, version, publisher and website. These will be visible to the user and will show up in their settings app/control panel.
  2. Select a destination folder for your application to install to. We recommend just changing the "Application Folder Name" and naming it after your program unless you're a more advanced user.

image

  1. When the wizard prompts you for the main executable file, you'll want to click "Browse" and browse to your Release Output Location. It should be the folder in which your project is saved. If you're unsure of it, rebuild your application and retrieve the location from your output console.
  2. You'll then want to click "Add Folder" and add the entire output folder that contains your application. You want to make sure that all the files and folders in your release output folder are included.
  3. Continue and follow the prompts until your script is generated. Save your script somewhere, perhaps in the folder along with the rest of your project.
  4. Click Run or Build and test your new setup executable. Be sure to test the application as it's installed, and we recommend testing it within a Windows Sandbox environment too, just to give you an idea of what the setup process will be like for a new user on a fresh PC.

Publishing your Executable

Now that you have your setup executable generated, you can publish it so people can download your application. There are a few considerations as to how you'll do this, but most people will host their executable online on their website, GitHub or on a forum.

Digital Signing

It may be worth digitally signing your application if you want users to have the easiest experience downloading and installing your program. Applications that are not digitally signed are often seen as untrustworthy by anti-virus programs, modern browsers and operating systems. Users that attempt to install your program may have their browsers and computers warn them that it may be unsafe to install. If you don't want to digitally sign your applications, perhaps make a note of it and give the users instructions on how to continue if their PC or Browser urges them not to continue.

It is important to note, however, if a user is told a program may be unsafe there is a relatively high chance that the user will not continue with the setup. Typical end users do not have a strong reason to disbelieve their computer during such a warning.

Moxo QuickWeb


QuickWeb for dotLX allows you to run your existing web-app on Windows, natively, using the next generation of the Code LX Programming Language: dotLX. Learn More



QuickWeb for .NET allows you to turn your existing web-app into a native .NET Windows app that can be further extended and edited using C#, .NET Framework and Visual Studio. Learn More

Clone this wiki locally