Scenario: Deploying .NET ClickOnce in CA Plex Application

Introduction

Product: CA Plex

Release: 7.1

This scenario describes how as a CA Plex Developer, you can deploy .NET ClickOnce in your CA Plex application.

In earlier releases, you can select an entry function for a Code Library. When you compile a C# Code Library containing an entry function, an executable is created for it, which calls the specified function. You can now model your application deployments completely through Code Libraries without having to create an executable through the Generate and Build window.

With CA Plex 7.1, you need not create an executable for the C# function. However, you can still call it using the CA Plex .NET Runtime Bootstrap executable, named PlexRuntimeLauncher.exe. This executable is shipped with CA Plex r7.1. You can use this executable to call both .NET Client and Server functions.

This method is useful if you want to call Plex generated C# functions through a scheduler or a scripting environment.

This Knowledge Base Article constitutes a portion of the official CA product documentation for this CA product. This Knowledge Base Article is subject to the following notices, terms and conditions.

How to deploy .NET ClickOnce in CA Plex

As a CA Plex Developer, you can deploy .NET ClickOnce in your CA Plex application. You can now model your application deployments completely through Code Libraries without having to resort to creating executables through the Generate and Build window.

In addition, you can deploy the ClickOnce in Microsoft Visual Studio, using the code library project files that are generated through the Code Library Wizard. ClickOnce is a Microsoft deployment technology that enables you to create self-updating Windows-based applications that can be installed and run with minimal user interaction.

The following diagram illustrates how you can deploy .NET ClickOnce in your application:

Prerequisites

You must have the following prerequisites to deploy the .NET ClickOnce:

Build a .NET Executable using the Code Library Wizard

In this section, you define an entry function of your application, so you can create a C# Visual Studio project file (.csproj) to create an executable (.exe) for the code library using the Code Library Wizard.

Example:

You can now build a .NET executable using the predefined sample model that is located in the \Dot NET ClickOnce\ folder. The sample model has two predefined entities that scope two functions. These entities and the functions they contain are organized into package objects. The P_Tier1 and P_Tier2 packages are associated with two separate code library objects, as shown in the following screen:

The P_Tier1 and P_Tier2 packages

Based on this design, if you build functions with the Code Library Wizard, you get two assembly DLLs. For more information about the code library objects, see the Code libraries and .NET section from the CA Plex User Guide.

In 7.1, you can specify an entry function for a code library. In other words, you can specify an executed function when you run the code library, after it is built into an Assembly. To define the specific function as the code library’s entry function, use the CDL entry function FNC triple.

Follow these steps:

  1. Specify the Tier1.Main function as an entry function for the CL_Tier1 code library.
  2. Open the model editor and drop the CL_Tier1 code library into the source object field.
  3. Select entry function FNC as the verb and drop Tier1.Main function to the target object field and click Enter to add a new triple.

    Model Editior - Code Library

    Note: Now you are ready to generate and build the application. Use the Code Library Wizard to build your functions, so you can generate the function source code from within Plex.

  4. Select the P_Tier1 and P_Tier2 packages, right-click, and select Generate.

    The packages are promoted.

  5. Select Yes to generate the source code.

    The source is generated.

  6. Select Tools, Code Library Wizard… to launch the Code Library Wizard to compile all the functions defined in the two code library objects.
  7. Create an .exe file for the entry function.
  8. Click Next in the Code Library Deployment Wizard.
  9. Select all code libraries in the Select Code Libraries dialog and click Next.
  10. Click Next in the Build Properties dialog.
  11. Click Next in the Plugin Options dialog.

    The compilation starts and you can see the .exe is built in addition to the assembly for code library CL_Tier1.

  12. Click Next after compilation is complete in the Code Library Creation dialog.

    The Windows explorer pops-up displaying the build target folder.

  13. Confirm the output artifacts that are created for your application (the assemblies, executable files, configuration files, and other runtime support files).

    Note: Now you have the CL_Tier1.dll assembly containing the main application logic and CL_Tier1.App.exe, an executable created for the code library with an associated configuration file.

  14. Click Finish to complete the code library completion.

    Note: The two assemblies CL_Tier1.dll and CL_Tier2.dll, and one .Exe file CL_Tier1.App.exe is displayed in the windows explorer pop-up that was launched.

  15. Double-click the CL_Tier1.App.exe to run the application.

You have now generated, built, and run CA Plex .NET Client application with multiple assemblies with an entry executable using the Code Library Wizard.

Build a ClickOnce Deployment with Microsoft Visual Studio

In this section, you use Microsoft Visual Studio 2010 to build a ClickOnce deployment application. If you are using the latest version of Visual Studio, the images or menu options may differ from this example.

Before you start, create and share a C:\deploy folder, so you can access the folder with \\localhost\deploy.

Example:

Use the Microsoft Visual Studio 2010 or later to create a ClickOnce deployment application.

Follow these steps:

  1. Open Windows Explorer and navigate to the C:\Users\Public\Documents\CA\Plex\7.1\Samples\Dot Net ClickOnce\Gen\Src folder.

    The following three.csproj files that were created using the Code Library Wizard are listed in the folder. Use these project files to create a ClickOnce deployment of the application

  2. Start Visual Studio 2010 and open the CL_Tier1.App.exe.csproj file.

    This file automatically creates a solution file.

  3. Click the Save As icon.

    The Save File As dialog opens.

  4. Provide the solution file name and click Save to save your solution.
  5. Add the other two assembly projects to the solution that you saved.
    1. In the Solution Explorer, select the CL_Tier1.App.exe project, right-click, and select Add, Existing Project….

      The Add Existing Project dialog opens.

    2. Navigate to the C:\Users\Public\Documents\CA\Plex\7.1\Samples\Dot Net ClickOnce\Gen\Src folder and select CL_Tier1.csproj and CL_Tier2.csproj, and click Open.

      The Visual Studio Solution Explorer displays the three projects as shown in the following screen:

    Solution Explorer

  6. Add references to the assembly projects against the executable project.
    1. In the Solution Explorer, select the CL_Tier1.App.exe project, right-click, and select Add Reference….

      Important! Adding reference is mandatory for successful deployment of ClickOnce with the application.

      The Add Reference dialog opens.

    2. Select the Projects tab and select the two projects that are listed and click OK.

      The Visual Studio Solution Explorer opens listing the newly added references when you expand the References under the CL_Tier1.App.exe project.

    Solution Explorer

  7. (Optional) Customize your ClickOnce deployment by adding extra options.
  8. Deploy the CL_Tier1.App.exe project using the ClickOnce.
    1. In the Solution Explorer, select the CL_Tier1.App.exe project, right-click, and select Publish....

      The Publish Wizard opens.

    2. Specify the location to publish the application as C:\deploy\myapplication and click Next.
    3. Select one of the installation modes and click Next.
    4. Select The Application will check for updates from the following location option and set the location to \\localhost\deploy\myapplication\ and click Next.
    5. Click Finish.

    After the successful deployment, Visual Studio opens Windows Explorer and displays the packaged application.

  9. Install and run the application.
    1. Double-click the Setup.exe.
    2. Follow the installation instructions to install the application.
    3. After the successful installation, close the application and Visual Studio.

Customize Your ClickOnce Deployment

Add the following extra options to customize and publish your ClickOnce deployment.

Follow these steps:

  1. In the Solution Explorer, select the CL_Tier1.App.exe project, right-click, and select Properties.

    The project properties dialog opens.

Redeploy your Updated .NET Application with the ClickOnce Deployment

In this section, change the application in the Plex model, recreate the ClickOnce deployment, and run the already deployed application.

Follow these steps:

  1. Add a feature to the application that you have already deployed.
    1. Open the Plex model and add Fnc3 function to the Tier2 entity.
    2. In the Plex Model Editor, add the following triples:

      Tier2 FNC function FNC Fnc3.

    Plex Model Editor

    Tier2.Fnc3 FNC is an FNC UIBasicShell.

    Function FNC

    1. In the Object Browser, double-click the panel, Tier1.Main.Panel.

      The Panel Designer dialog opens.

    2. In the Panel Designer, add a new button Fnc3.

      The Event Mappings dialog opens.

    3. Select Pressed from the Physical Event pane and map it to CallFnc3 logical event and click OK.

    Panel Designer

    1. Open the Action Diagram for the Tier1.Main function and add code to call Tier2.Fnc3 when the CallFnc3 logical event occurs.
    2. In the Generate and Build dialog, save the model and generate the two functions Tier1.Main and Tier2.Func3.
  2. Use the Code Library Wizard to compile the source files.
    1. Follow the steps 6 through 13 from building a .NET executable using the Code Library Wizard.

      You now have the recompiled assemblies Tier1.dll and Tier2.dll.

  3. Rebuild the ClickOnce deployment.
    1. Open the CL_Tier1.App.exe.sln solution file in C:\Users\Public\Documents\CA\Plex\7.1\Samples\Dot Net ClickOnce\Gen\Src folder with Visual Studio.
    2. Right-click the file and select Publish… to recreate the ClickOnce deployment.

      All your customized settings are saved while building a ClickOnce deployment and are available for you now.

    3. In the Publish Wizard dialog, click Finish to republish the application.

      The Visual Studio opens Windows Explorer and displays the directory that the packaged application has deployed to.

  4. Install and run the application.
    1. Double-click the desktop shortcut icon.
  5. Check updates.
    1. The application looks for a newer version.

      Note: This occurs because you have customized and enabled an option to check for updates each time before the application runs.

    2. You are prompted to confirm to install the application updates on your local system.
    3. Follow the instructions to redeploy the application updates.

      Note: If you have Windows 8 installed, you might get an extra security pop-up. Choose to run the application to continue with the redeployment.

    After the successful installation, the updated application is ready for use.

You have now changed the .NET application functionality and then redeployed your updated application with ClickOnce.

Copyright

Copyright © 2014 CA. All rights reserved. All trademarks, trade names, service marks, and logos referenced herein belong to their respective companies.

Back to the Top