Skip to Content

This is an attempt at showing how to publish a PB.net app to a web server with click once deployment that will check for and install prerequisites. I found that the bootstrapper that comes with PB works fine for installing the PB runtime but fails for the .Net framework. Rather than deploying a “Hello World” app to illustrate this I’ve created an app with a simple WPF window with a media element that can play videos by dragging and dropping them onto the window. It has three buttons to play, pause and stop the video as well as volume and seek sliders. I found a C# example on the internet that does this and wanted to see if I could do it with PB. The two prerequisites required for this app are the .Net 4.0 framework and the PB.net runtime. I will show you how to configure the bootstrapper to install these.

Here are the prerequisites you’ll need…

1.      PB.Net 12.5.1

2.      The source code for this project (https://skydrive.live.com/#cid=D13D80A62EA55460&id=D13D80A62EA55460%21108 videodemo.pbl.zip)

3.      An MSI of the PB.net runtime components (Can be made with PB Runtime packager that comes with PB). You should call it PBRuntime.msi for this example.

4.      DotNetInstaller open source program. Can be found at http://dblock.github.io/dotnetinstaller/

5.      A copy of the web installer exe from Microsoft. Can be found here: http://www.microsoft.com/en-us/download/confirmation.aspx?id=17851 . You should download and rename it to dotnetfx.exe.

Here’s a quick rundown of the steps I’m going to describe…

1.      Configure the PB WPF project for deployment

2.      Publish it to a server running Windows Server 2008 and IIS

3.      Create the bootstrapper program that will install the prerequisites

4.      Test the install

1.      Configure the project for deployment

a.      General Tab

                                                              i.      GeneralTab.PNG

b.      Sign Tab

                                                              i.      Create a key file by clicking on the new button. Call it whatever you like.

                                                            ii.      SignTab.PNG

c.      Publish Tab

                                                              i.      I use the FTP method to deploy to the server. I would discourage using localhost because your development machine has PB and the .Net framework on it so that wouldn’t really be a good test. What will happen is a directory on the server will get created called VideoDemo and the app will be deployed there. Note the publish page name.

                                                            ii.      PublishTab.PNG

d.      Install Tab

                                                              i.   InstallTab.PNG 

e.      Prerequisites Tab

                                                              i.      PrerequisitesTab.PNG

f.      Save your changes to the Project (Click Save button)

g.      Do a full build (Click Full build button)

h.      Publish the project to the server (Click Publish button)

                                                              i.      Once the publish is finished you should see the publish.htm page show up in your browser. Note the prerequisites and the links below them.

                                                            ii.      PublishPage.PNG

                                                          iii.      If you click on the first link to install the prerequisites you will be able to install the PB runtime but will fail when trying to install the .Net framework (at least that was my experience).

                                                          iv.      If you have the prerequisites already installed you can click on the second link to install the app and it should run just fine.

i.        Create the bootstrapper

                                                              i.      Now let’s fix the problem with the .Net prerequisite installation. We need to create a new bootstrapper (setup.exe) program that will correctly install the .Net 4.0 framework.

                                                            ii.      The online help describing the process and where the files go is here: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00586.1252/doc/html/san1273518402442.html

                                                          iii.      Now that you are familiar with the files fire up the dotnetinstaller program you installed as a prerequisite to this process.

                                                          iv.      Open file C:\program files\Sybase\Powerbuilder 12.5\DotNet\pbiu\Bootstrapper\Packages\1-PBRuntime\configuration.xml

                                                            v.      When asked to convert from version 1 to 2.2.824.0 choose Yes.

                                                          vi.      Immediately save this file in your publish folder of your project as configuration.xml.

                                                        vii.      Make sure you change the sourceurl setting to point to your pbruntime msi file.

1.      PBRuntimeDownload.PNG

                                                      viii.      Change the install check to the following. The one out of the box didn’t work for me.

1.      InstallCheck.PNG

                                                          ix.      Now open the file C:\program files\Sybase\Powerbuilder 12.5\DotNet\pbiu\Bootstrapper\Packages\0-dotnetfx\configuration.xml

                                                            x.      When asked to convert from version 1 to 2.2.824.0 choose Yes.

                                                          xi.      There are two sections. One for early versions of windows and one for Windows 2000 and later. Copy the Windows 2000 and later section to your config. Make sure the sourceurl points to your dot net web installer exe.

1.      DotNetDownload.PNG

                                                        xii.      Now build the bootstrapper by pressing F10

1.      When the Create Executable window opens you will be prompted for the location of the dotNetInstaller.exe. It should be installed here: C:\Program Files\dotNetInstaller\bin\dotNetInstaller.exe

2.      Click the Make button and call it setup.exe in the publish directory of your app.

3.      Once the setup.exe is created copy it and configuration.xml to your server and replace the files there.

j.        Test the install

                                                              i.      Navigate to http://[your server name]/videodemo/publish.htm.

1.      Click the prerequisite link to open this window.

a.       PrerequisiteLink.PNG

2.      Install the prerequisites by clicking the install button.

a.       Reboot.PNG

b.      If your machine has .net 4.0 installed you will get this message which is fine. We’ve tested that the installer was launched which was the problem.

                                                                                                                                      i.      DotNetCheck.PNG

c.      Click the Close button to go back to the publish.htm page.

d.      Now that the prerequisites are installed we can install the app. I’m sure with more time we can integrate that in with the prerequisites but anyway…

e.      Click the link to install the app.

                                                                                                                                      i.      The app should install and launch itself.

1.      Locate a video file using windows explorer and drop it on the window. There’s one that comes with Windows 7 called Wildlife.wmv in the C:\Users\Public\Videos\Sample Videos directory that is pretty cool.

2.      VideoScreenShot.PNG

                                                                                                                                    ii.      I hope this was helpful.

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Guillaume Mayer

    Helpful for sure, I didn’t know that you could customize the prerequisites installer.

    Is it possible to have a full installer (Inno Setup or InstallShield for example) as a replacement for the Setup.exe ?

    The html generated page would have to be customized too, it’s not very beautiful, and on the first link, it’s not clear if you are installing the prerequisites or the app itself.

    Thanks for sharing.

    (0) 
    1. Mark Libner Post author

      Hi Guillaume,

                             

      Helpful for sure, I didn’t know that you could customize the prerequisites installer.

                         

      Neither did I until I started investigating why my setup failed on a clean machine. Then I just got curious and well you know how that goes.

      Is it possible to have a full installer (Inno Setup or InstallShield for example) as a replacement for the Setup.exe ?

      I don’t think you would want to do that. From what I’ve read so far the dotNetInstaller is purely for creating a bootstrapper to install prerequisites not to replace installers.

      The html generated page would have to be customized too, it’s not very beautiful, and on the first link, it’s not clear if you are installing the prerequisites or the app itself.

      Yeah the publish.htm is pretty bare bones but could certainly be improved upon.

      I’m curious why the bootstrapper PB created didn’t work in the first place for the .Net 4.0 Framework. The configuration.xml files that shipped with PB 12.5 were from an earlier version of dotNetInstaller. Could that be the reason? Who knows. Maybe others can shed some light on it for us.

      (0) 
      1. Guillaume Mayer

        Hi Mark,

        Neither did I until I started investigating why my setup failed on a clean machine. Then I just got curious and well you know how that goes.

        Well known process indeed, so called Bug Driven Development 😉

        I don’t think you would want to do that. From what I’ve read so far the dotNetInstaller is purely for creating a bootstrapper to install prerequisites not to replace installers.                

        Maybe it’s possible to add a third prerequisite, which will be in fact a customized MSI to do what clickonce can’t do, like register COM components, RegAsm, Fonts, proper uninstall…

        (0) 
        1. Mark Libner Post author

          I think you can have countless prerequisites. If the PB bootstrapper worked you would just need to add them each as a separate folder under C:\Program Files\Sybase\PowerBuilder 12.5\DotNET\pbiu\BootStrapper\Packages. Since it doesn’t, just make sure you add the correct component to the install tree using the dotNetInstaller program when you create your setup.exe file. The only two I’ve used so far are Msi and Exe.

          Fyi The component add wizard has an option to install 4.0 framework from Microsoft’s web site (among other things). I haven’t tested it though.

          (0) 

Leave a Reply