Create a Document Viewer Application using the .NET CLI Project Template
- 2 minutes to read
You can use the .NET command-line interface (CLI) to create an application with the WinForms Document Viewer control from the console. Note that the project template targets .NET 8.0+ and supports C# only.
Install DevExpress CLI Templates
Execute the following command to install DevExpress WinForms project templates from nuget.org:
dotnet new install DevExpress.Win.ProjectTemplates
If the NuGet.org package source is disabled, you will get the following error: NU1101: Unable to find package DevExpress.Win.ProjectTemplates. To see the list of sources and their status information, run the command dotnet nuget list source. To enable a source, run the command dotnet nuget enable source <source name>.
If you are new to NuGet, visit the following page for more information about package management prerequisites: An Introduction to NuGet.
Note
DevExpress CLI project templates are also available in the DevExpress NuGet Gallery (nuget.devexpress.com).
Create a Project
To create a WinForms Document Viewer application, execute the following command:
dotnet new dx.win.reporting -n WinDocumentViewer
The command creates a WinForms application with Document Viewer called WinDocumentViewer in the current directory.
You can use the following parameters to see available command options: -? | -h | --help. For example, execute the following command:
dotnet new dx.win.reporting --help
Refer to the following documents for information on template options:
- dotnet new command - Options
- Standard options for .NET CLI templates.
- Template Options
- Options specific to the DevExpress WinForms templates.
Build the Project
You need to configure your personal DevExpress NuGet Feed to load the required DevExpress component packages and build the resulting project. Follow the instructions below:
- Obtain your NuGet feed URL.
Register the source. You can do this in your IDE or from a CLI:
Template Options
The following list contains options you can specify when creating DevExpress WinForms Reporting project templates:
-prerelease, --use-prerelease-dx-version- A flag that indicates whether to use a pre-release DevExpress package version in the project.
--framework <TFM>- Specifies the target framework. It expects a target framework moniker (TFM). Example:
net8.0. --dx-version <version>- Specifies DevExpress package version to be used in the project. Examples:
25.2.3,25.2.*,25.2.*-* --dx-nuget-feed <feed>- Specifies the NuGet Feed URL. Refer to nuget.devexpress.com to obtain your personal feed URL (available for registered users).