4 Setting Up Development Tools for the Universal Windows Platform

This chapter provides information on setting up and configuring development tools for the Universal Windows platform. Install Visual Studio along with needed SDKs and create and install the PFX file so that you can deploy the MAF applications developed in JDeveloper to the Universal Windows Platform.

This chapter includes the following sections:

4.1 Installing Visual Studio

Install Visual Studio 2017 along with the required Windows 10 SDKs.

The Visual Studio installer also allows you to install the Windows SDKs that enable deployment of applications to the UWP. Here are the other components you must install.

  • MSBuild 15.0 (automatically installed with Visual Studio 2017)

  • Universal Windows Platform development tools (a workload available when installing Visual Studio 2017)

  • Windows 10 SDK 10.0.10586.0 (an optional component available when installing Visual Studio 2017)

  • Windows 10 SDK 10.0.14393.0 (an optional component available when installing Visual Studio 2017)

To install Visual Studio 2017:
  1. Ensure MAF and JDeveloper (12.2.1.3.0) are installed on a computer with x86 architecture running the Windows 10 operating system (version 1511 or later).
  2. Download an edition of Visual Studio 2017 available at: https://www.visualstudio.com/downloads/.
    Select the Visual Studio edition that you require: Community, Professional, or Enterprise. All editions provide the required software to develop and deploy a MAF application to the UWP. Visit the Visual Studio Community product page for information about the eligibility criteria to use Visual Studio Community edition.
  3. During the Visual Studio 2017 installation, select these options.
    1. Select the Universal Windows Platform development workload.
    2. Select Windows 10 SDK (10.0.10586.0) and Windows 10 SDK (10.0.14393.0) available under the Individual components.

      Note:

      If you are migrating from an existing MAF and Visual Studio 2015 installation, you might already have the required Windows 10 SDKs installed. If you are performing a fresh installation of Visual Studio 2017, you must install these Windows 10 SDKs.

      Figure 4-1 Installing Visual Studio 2017

      Description of Figure 4-1 follows
      Description of "Figure 4-1 Installing Visual Studio 2017"

      For more information on the Windows 10 SDKs, see: https://developer.microsoft.com/en-us/windows/downloads/sdk-archive.

4.2 Creating a PFX File for MAF Applications

MAF applications deployed to the UWP must be digitally signed using a Personal Information Exchange (PFX) file.

Use Microsoft’s New-SelfSignedCertificate cmdlet in a PowerShell console with administrator privileges to create a PFX file.

To create a PFX file:
  1. Click Start, type PowerShell, right-click Windows PowerShell, and then click Run as administrator.
    The PS C:\windows\system32> prompt is displayed.
  2. Change the value for the -Subject parameter, as required and run the following command.
    New-SelfSignedCertificate -CertStoreLocation cert:\localmachine\my -Subject 'CN=Example,OU=MAF,O=Oracle,C=US' -KeyAlgorithm RSA -KeyLength 2048 
    -Provider 'Microsoft Enhanced RSA and AES Cryptographic Provider' -KeyExportPolicy Exportable -KeyUsage DigitalSignature 
    -Type Custom -TextExtension @('2.5.29.37={text}1.3.6.1.5.5.7.3.3,1.3.6.1.4.1.311.10.3.13','2.5.29.19={text}CA=False')
    
    In the command:
    • -CertStoreLocation: Specifies the certificate store in which to save the new certificate.

    • -Subject: Specifies the string that appears in the subject of the new certificate.

    • -KeyAlgorithm: Specifies the algorithm used to create the asymmetric certificate key.

    • -KeyLength: Specifies the length (in bits) of the certificate key.

    • -Provider: Specifies the name of the KSP or CSP that the cmdlet uses to create the certificate.

    • -KeyExportPolicy: Specifies the policy that governs the export of the private key.

    • -KeyUsage: Specifies the key usages set in the key usage extension of the certificate.

    • -Type: Specifies the type of certificate that the cmdlet creates.

    • -TextExtension: Specifies an array of certificate extensions (strings) the cmdlet includes in the new certificate.

    For more information on the parameters, see Microsoft’s documentation.

    If successful, the command prints the thumbprint ID and subject of the certificate. Here is a sample output.

    PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\my
    
    Thumbprint                                Subject
    ----------                                -------
    EA8DA38619D6FF49C9BBE51651DDD6950EF767AE  CN=Example, OU=MAF, O=Oracle, C=US
    
  3. Enter the following command.
    $pwd = ConvertTo-SecureString -String '<password>' -Force -AsPlainText
    

    In the command, replace <password> with a suitable password.

  4. Enter the following command to create the PFX file.
    Export-PfxCertificate -cert cert:\localMachine\my\<thumbprint ID> -FilePath <path> -Password $pwd
    

    In the command:

    • Change <thumbprint ID> to the value output to the console (for example, EA8DA38619D6FF49C9BBE51651DDD6950EF767AE)

    • Change <path> to your preferred path, such as c:\someDir\MyPFX.pfx

  5. Navigate to the specified path and verify whether the PFX file was created.

4.3 Installing a PFX File on Windows 10

Install a Personal Information Exchange (PFX) file in a certificate store on a computer so that the certificate can be used for application signing.

A Software Publisher Certificate (SPC), with its private and public keys, is used for application signing and is stored in a Personal Information Exchange (.pfx) file. A PFX file has to be copied or installed to a certificate store, where the operating system keeps all certificates.

Note:

The installation has to be completed once, manually, for every PFX file on a given computer.
To install a PFX file in a certificate store:
  1. Locate and double-click the .pfx file to open the file in the Certificate Import Wizard.
  2. Select Current User as the Store Location, and then click Next.
    When you install the PFX file in the Local Machine store, the Windows User Access Control dialog is opened. Click Yes for Do you want to allow this app to make changes to your PC?
  3. Verify whether the name in the File name field is the one you want, and then click Next.

    Note:

    The default file location is the location of the file that you double-clicked.
  4. Enter a password for the private key, if required.
  5. Select Included all extended properties, and then click Next.
  6. Select Place all certificates in the following store, and click Browse.
  7. In Select Certificate Store, select the certificate store that matches the store location, Personal , click OK.
  8. Click Next, and then on Completing the Certificate Import Wizard, click Finish to import the certificate.
    This procedure installs the PFX file in the Personal certificate store.
  9. Run the Certificate Import Wizard a second time, select the Current User location, and the Trusted People certificate store.
  10. Run the Certificate Import Wizard a third time, select the Local Machine location, and the Trusted People certificate store.

4.4 Specifying the UWP Settings in MAF

Configure the UWP-specific settings, such as Windows SDK location and PFX file information to package and deploy applications to the UWP platform.

To package and deploy applications to the platforms supported by MAF, JDeveloper needs the name of the platform and the names of the directories containing platform-specific tools and data. For convenience, MAF populates JDeveloper Preferences with these settings. Each platform-specific page hosts the preferences for the platform SDK (Android, iOS, or Windows), collecting information, such as the path that MAF needs to compile and deploy Android, iOS, or Windows projects.

To configure your environment for the UWP platform:

  1. Ensure the needed Windows SDKs are installed when installing Microsoft Visual Studio 2017.
  2. In JDeveloper, click Tools then Preferences.
  3. In the Preferences dialog, click Mobile Application Framework then Windows Platform.
  4. Specify the location of the Windows SDK files (MSBuild version 15.0).
  5. Provide the certificate (PFX file) location and password.
    You can use the same PFX file to run your application in the Release and Debug modes on your computer. We recommend that you use a certificate issued by a trusted authority, such as your internal CA, if you want to distribute your application and run it on other devices within your organization.

4.5 Enabling Developer Mode on Windows 10

Enable Developer Mode on the Windows 10 development computer to side-load applications and to run them in the Debug mode.

Windows 10 runs UWP applications from a trusted source. Since the certificates you imported are self-signed, they will not run by default. If you want to develop and deploy MAF applications to the UWP you must enable Developer Mode on the Windows 10 computer that you use. Developer Mode is required for the following reasons:

  • Side-load, or install and run applications, from unofficial sources.

  • Run an application in the Debug mode.

To enable Developer Mode:
  1. Press the Windows key, search for Settings, and select Settings - Modern application from the displayed results.
  2. Select Update & Security, then For developers, and click Developer mode.

    Note:

    If you create an application in Visual Studio, the system prompts you with a dialog to enable Developer Mode.
  3. Configure settings for the Windows platform in JDeveloper as described in Specifying the UWP Settings in MAF.

4.6 Testing the Windows Environment Setup

Deploy a MAF sample application to test that you set up your Windows environment successfully.

You can test your environment setup as follows:
  1. In JDeveloper, open the HelloWorld sample application.

    See MAF Sample Applications in Developing Mobile Applications with Oracle Mobile Application Framework.

  2. Select Application then Deploy from the main menu.

    See Deploying Mobile Applications in Developing Mobile Applications with Oracle Mobile Application Framework.

  3. From the dropdown menu, select the deployment profile for the Windows platform.
  4. Select Deploy application to local machine in the Deploy dialog.
  5. Click Next on the Deploy dialog to verify the Summary page, and then click Finish.

See Deploying Mobile Applications in Developing Mobile Applications with Oracle Mobile Application Framework.

After a successful deployment (which might take a few minutes), the device to which you had deployed the application displays the launch screen of the HelloWorld application, and then displays the default application feature.