Symptom

If your development machine does not have Internet access, it may be challenging to develop PowerServer Apps, as this process requires downloading necessary database drivers and NuGet packages from NuGet.org. So, what can you do in such cases? This article provides a workaround solution, which involves two main tasks: first, downloading the required packages on a computer with Internet access, and second, transferring those packages to your development machine.


Environment
PowerServer 2021 or later


Resolution

1.    Task 1: Downloading NuGet packages on a computer with Internet access
It is necessary to find a computer with Internet access, and download the required NuGet packages.
Step 1.    Install the PowerBuilder version you plan to use (for example, 2022 R3 build 3397), including the PowerServer Toolkit, on a computer with Internet access.
Step 2.    Clear existing NuGet packages on this computer.
You can open CMD and call .NET CLI to clear NuGet global packages:

dotnet nuget locals global-packages –clear

For example: 

image1

Step 3.    Load the example Sales App application in the PowerBuilder IDE, and click the Run button in the PowerBuilder toolbar to make sure the application can run.
Note that for step 3 to 6, you may follow the instructions in the official PowerServer Quick Start Guide (Quick Start - - PowerServer 2022 R3 Help).
Step 4.    Create and configure a PowerServer project for the Sales App.  
When configuring the PowerServer project, ensure the required database type and authentication templates are selected in the 'Database' and 'Security' tabs, respectively. Additionally, set the Target Framework to .NET 8 in the 'Build tab', then it will include all necessary NuGet packages in the generated C# solution.
Step 5.    Build and deploy the PowerServer project.
Step 6.    Click Run PowerServer Project to run the deployed PowerServer App. This step will download and restore NuGet packages.


If the PowerServer Web API has been started successfully with the IDE, you will see the console:

image2
 
The required NuGet packages are downloaded into the following directory:
C:\Users\<username>\.nuget\packages\
For example:

image3

Copy these NuGet packages to a secure folder to ensure they are ready for transfer to the offline development machine.


2.    Task 2: Copy the NuGet packages to the development machine without Internet access
Step 1.    Use a USB drive or another IT-approved method to transfer the folder of NuGet packages from the previous task to the offline development machine.
Step 2.    Create a dedicated folder on the offline development machine to store these NuGet packages, such as “D:\OfflineNuGetPackages”.
image4

Step 3.    Configure NuGet package source by updating the NuGet.Config file.
This is a user scope NuGet.Config (%appdata%\NuGet\NuGet.Config).  There are two ways to update it:
(1) You can edit it to add the user scope source directly. 
E.g.:

<configuration>
 <activePackageSource>
    <add key="nuget.org0" value="https://www.nuget.org/api/v2/" />
 </activePackageSource>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageManagement>
    <add key="disabled" value="False" />
    <add key="format" value="0" />
  </packageManagement>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="PowerServer Offline Packages" value="D:\OfflineNuGetPackages" />
  </packageSources>
</configuration>

(2) You can open CMD and call .NET CLI to add the NuGet package source:

dotnet nuget add source "D:\OfflineNuGetPackages" --name "PowerServer Offline Packages"

You can refer to NuGet documentation to learn more details about NuGet.Config:
https://learn.microsoft.com/en-us/nuget/consume-packages/configuring-nuget-behavior
https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file#package-source-sections

3.    Developing the PowerServer application
After the NuGet package source configuration is complete, you are ready to Build and Deploy a PowerServer application.


4.    Running the PowerServer application
 While it is possible to develop and deploy a PowerServer application on a computer without Internet access, the machine running PowerServer Web APIs must be able to connect to ALL of the following Appeon sites to ensure the efficiency and reliability of the license server (Internet connection and Appeon domains - - Appeon License User Guide).

1
0