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
b. Sign Tab
i. Create a key file by clicking on the new button. Call it whatever you like.
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.
d. Install Tab
e. Prerequisites Tab
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.
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.
viii. Change the install check to the following. The one out of the box didn’t work for me.
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.
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.
2. Install the prerequisites by clicking the install button.
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.
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.
ii. I hope this was helpful.