Build and Publish Demo Applications

This topic explains how to build and publish the HiQPdf Next ASP.NET demo applications which can be downloaded as a ZIP file from the HiQPdf website. It should be used after completing the Getting Started guide for Windows and the corresponding Getting Started guide for Linux. The topic includes instructions for the Windows demo, the Linux demo and the Cross-Platform demo.

Build and Publish Demo - Windows

The Windows demo is located in the Windows folder and uses the HiQPdf.Next.Windows metapackage from NuGet, which contains .NET Standard 2.0 assemblies and the Windows runtimes for all HiQPdf Next components.

The demo application can be deployed to Windows servers, Azure App Service Windows, Azure Functions Windows or Docker Windows containers.

Project Description

The Windows demo project file is HiQPdf_Next_AspNetDemo_Windows.csproj and there are separate versions for .NET 8 and .NET 10. The target framework can be changed in the project file as described below.

Change Target Framework

As an example, the project that targets .NET 8.0 can be upgraded to target .NET 10.0 by simply changing the TargetFramework element in the .csproj project file from net8.0 to net10.0.

XML
<PropertyGroup>
  <TargetFramework>net10.0</TargetFramework>
</PropertyGroup>

Build from Command Line

To build the Windows demo application, run:

bash
dotnet build -c Release -r win-x64 HiQPdf_Next_AspNetDemo_Windows.csproj

The build output will be placed in bin\Release\net8.0 (or net10.0). To get a runnable folder including all assets, you must publish the application.

Publish

To publish the Windows demo application, run:

bash
dotnet publish -c Release -r win-x64 -o publish/windows HiQPdf_Next_AspNetDemo_Windows.csproj

The published application files will be available in the publish/windows folder.

You can add the self-contained option (-r win-x64 --self-contained true) to the publish command to create a self-contained deployment that does not require the .NET runtime to be installed on the target machine.

Run the Application

To run the published Windows demo application from the command line, execute the following command:

bash
dotnet publish/windows/HiQPdf_Next_AspNetDemo_Windows.dll

The application will start and listen on the configured port (for example http://localhost:5000) and you can access it from a web browser running on the same machine or remotely if the network is properly configured.

On Windows, no additional configuration is normally required. For platform-specific deployment details, consult the Getting Started on Windows guide as well as the specific guides for Publishing to Azure App Service Windows, Publishing to Azure Functions Windows or Publishing to Docker on Windows.

Build and Publish Demo - Linux

The Linux demo is located in the Linux folder and uses the HiQPdf.Next.Linux metapackage from NuGet, which contains .NET Standard 2.0 assemblies and the Linux runtimes for all HiQPdf Next components.

The demo application can be deployed to Linux servers, Azure App Service Linux, Azure Functions Linux or Docker Linux containers.

Project Description

The Linux demo project file is HiQPdf_Next_AspNetDemo_Linux.csproj and there are separate versions for .NET 8 and .NET 10. The target framework can be changed in the project file as described below.

Change Target Framework

As an example, the project that targets .NET 8.0 can be upgraded to target .NET 10.0 by simply changing the TargetFramework element in the .csproj project file from net8.0 to net10.0.

XML
<PropertyGroup>
  <TargetFramework>net10.0</TargetFramework>
</PropertyGroup>

Build from Command Line

To build the Linux demo application, run:

bash
dotnet build -c Release -r linux-x64 HiQPdf_Next_AspNetDemo_Linux.csproj

The build output will be placed in bin\Release\net8.0 (or net10.0). To get a runnable folder including all assets, you must publish the application.

Publish

To publish the Linux demo application, run:

bash
dotnet publish -c Release -r linux-x64 -o publish/linux HiQPdf_Next_AspNetDemo_Linux.csproj

The published application files will be available in the publish/linux folder.

You can add the self-contained option (-r linux-x64 --self-contained true) to the publish command to create a self-contained deployment that does not require the .NET runtime to be installed on the target machine.

Run the Application

To run the published Linux demo application from the command line, execute the following command:

bash
dotnet publish/linux/HiQPdf_Next_AspNetDemo_Linux.dll

The application will start and listen on the configured port (for example http://localhost:5000) and you can access it from a web browser running on the same machine or remotely if the network is properly configured.

On Linux, additional packages must be installed before running HTML to PDF conversion. For platform-specific deployment details and the list of required system dependencies, consult the Getting Started on Linux guide as well as the specific guides for Publishing to Azure App Service Linux, Publishing to Azure Functions Linux or Publishing to Docker on Linux.

Build and Publish Demo - Cross-Platform

The Cross-Platform demo is located in the AllPlatforms folder and uses the HiQPdf.Next metapackage from NuGet, which contains .NET Standard 2.0 assemblies and the runtimes for all HiQPdf Next components for both Windows and Linux platforms.

The HiQPdf.Next package automatically includes:

This package is ideal when developing on one OS and deploying on multiple runtime environments. The demo application can be deployed to Windows and Linux servers, Azure App Service, Azure Functions or Docker containers for both Windows and Linux.

Project Description

The cross-platform project file is HiQPdf_Next_AspNetDemo_All_Platforms.csproj and there are separate versions for .NET 8 and .NET 10. The target framework can be changed in the project file as described below.

Change Target Framework

As an example, the project that targets .NET 8.0 can be upgraded to target .NET 10.0 by simply changing the TargetFramework element in the .csproj project file from net8.0 to net10.0.

XML
<PropertyGroup>
  <TargetFramework>net10.0</TargetFramework>
</PropertyGroup>

Build Portable

To build the portableversion:

bash
dotnet build -c Release HiQPdf_Next_AspNetDemo_All_Platforms.csproj

Publish Portable

Publish the portable version:

bash
dotnet publish -c Release -o publish/portable HiQPdf_Next_AspNetDemo_All_Platforms.csproj

The portable build can run on any supported platform where the .NET runtime is installed.

Publish for a Specific Platform

Publish for Windows:

bash
dotnet publish -c Release -r win-x64 -o publish/windows HiQPdf_Next_AspNetDemo_All_Platforms.csproj

Publish for Linux:

bash
dotnet publish -c Release -r linux-x64 -o publish/linux HiQPdf_Next_AspNetDemo_All_Platforms.csproj

You can add the self-contained option (--self-contained true) together with the runtime identifier (for example -r win-x64 for Windows or -r linux-x64 for Linux) to the publish command to create a self-contained deployment that does not require the .NET runtime to be installed on the target machine.

Limit to a Specific Platform

Building for all platforms supported by the HiQPdf.Next metapackage may bring many files in the output folder. During development it is often useful to restrict build output to a single OS.

To limit the build and publish to a specific platform, set the RuntimeIdentifier property in the project file.

To limit to Windows x64:

XML
<PropertyGroup>
  <RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>

To limit to Linux x64:

XML
<PropertyGroup>
  <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
</PropertyGroup>

Run the Application

The HiQPdf Next libraries automatically detect the operating system at runtime and use the appropriate files for the platform.

On Windows, no additional configuration is normally required. For platform-specific deployment details, consult the Getting Started on Windows guide as well as the specific guides for Publishing to Azure App Service Windows, Publishing to Azure Functions Windows or Publishing to Docker on Windows.

On Linux, additional packages must be installed before running HTML to PDF conversion. For platform-specific deployment details and the list of required system dependencies, consult the Getting Started on Linux guide as well as the specific guides for Publishing to Azure App Service Linux, Publishing to Azure Functions Linux or Publishing to Docker on Linux.

Run the portable build which will automatically select the runtime based on the host platform:

bash
dotnet publish/portable/HiQPdf_Next_AspNetDemo_All_Platforms.dll

Run after Windows publish:

bash
dotnet publish/windows/HiQPdf_Next_AspNetDemo_All_Platforms.dll

Run after Linux publish:

bash
dotnet publish/linux/HiQPdf_Next_AspNetDemo_All_Platforms.dll

Next Steps

You can now continue with the platform-specific deployment guides such as Publishing to Azure App Service Windows or Publishing to Azure App Service Linux for Azure App Service, Publishing to Azure Functions Windows or Publishing to Azure Functions Linux for Azure Functions, Publishing to Docker on Windows or Publishing to Docker on Linux for Docker.

See Also