Skip to main content Skip to footer

Using ComponentOne WPF Controls with the NuGet Package Manager

Starting with our 2019 v3 release, all ComponentOne WPF 4.5.2 .NET Framework controls are available via NuGet for use in .NET Framework and .NET Core WPF projects.

NuGet is a package manager integrated into Visual Studio. It makes adding and updating new tools and features into your projects quick and easy.

When you add a NuGet package to your solution, it integrates into that project's references and becomes available in your toolbox to add to an XAML form.

Configure NuGet Package Manager

We publish our packages to the public Nuget.org server so anyone can find them. The address should already be configured in your Visual Studio. For access, go to Tools > NuGet Package Manager > Package Manager Settings and then select, Package Sources.

Using ComponentOne WPF Controls with the NuGet Package Manager

Using ComponentOne WPF Controls with the NuGet Package Manager

The default https://www.nuget.org/api/v2/ should already be configured.

Configuring a local NuGet Repository

You can configure a local NuGet repository and point it to the local or network directory where you store your .nuget files. We include a copy of all our packages in the C:\Program Files (x86)\ComponentOne\Packages folder. Add your own by clicking the + at the top of the Package Sources window. Provide a name and configure the path to the directory.

Using ComponentOne WPF Controls with the NuGet Package Manager

Note: Using the online repositories is preferable as it enables you to quickly access new releases and features. The local repository works best if you have an offline machine and can’t access nuget.org.

Using NuGet Package Manager

To add a Nuget package to your application, from the dropdown menu, select Tools > NuGet Package Manager > Manage NuGet Packages for Solution.

Using ComponentOne WPF Controls with the NuGet Package Manager

When the window opens, choose the “Browse” option in the top left corner. Search for the control you want in the search box. For example, “C1 WPF FlexGrid.”

Using ComponentOne WPF Controls with the NuGet Package Manager

Select the controland checkmark the project on the right you want the control added to. Choose from various versions of the control and then click “Install.”

Using ComponentOne WPF Controls with the NuGet Package Manager

Click “OK” on the preview changes dialog.

Click “I Accept” on the License Acceptance dialog.

Using ComponentOne WPF Controls with the NuGet Package Manager

The Control is now added to your toolbox and the necessary references added to your project.

Using ComponentOne WPF Controls with the NuGet Package Manager

Drag the control onto the artboard of the XAML just like you would with a traditional install of ComponentOne controls.

Updating Using the NuGet Package Manager

To update the ComponentOne controls in your application, follow these steps:

  1. Launch the NuGet Package Manager and select the “Installed” option at the top
  2. Select the C1 control you want to update, select the new version in the “Version:” dropdown on the right, and click Update
  3. Confirm the changes and accept the license agreement for NuGet

In the example screen below, we go from 4.5.20193.685 to the 4.5.20201.697 version.

Using ComponentOne WPF Controls with the NuGet Package Manager

Using the NuGet Package Manager Console

If you prefer CLI interfaces, install and update your NuGet packages with the NuGet Package Manager Console. To launch the console, click Tools > NuGet Package Manager > Package Manager Console.

Using ComponentOne WPF Controls with the NuGet Package Manager

The console opens by default in the same lower window as your error and output lists.

Using ComponentOne WPF Controls with the NuGet Package Manager

To install a package, use the command Install-Package and the package name, in our case, we use:
Install-Package C1.Xaml.WPF.FlexGrid
Using ComponentOne WPF Controls with the NuGet Package Manager

This executes and installs the latest version available. Note, you will not get the confirmation or license agreement prompts with the command line version. The control now appears in your toolbox and references. Using the control works the same way. You can alternatively specify a version to install with a -version switch.

Using ComponentOne WPF Controls with the NuGet Package Manager

Updating Using the NuGet Package Manager Console

Update via the console using the Update-Package command. In the example above, we installed the .NET 4.5.2 2019v3 build .685 version. We can update to the latest version using

Update-Package C1.Xaml.WPF.C1FlexGrid

This updates the control and any dependences to the latest version. Specify a -version switch if needed in the Update-Package command.

NuGet Package Manager Conclusion

The NuGet Package Manager is a powerful and versatile tool and works great with controls and tools like those found in ComponentOne Studio.

Licensing for our controls works the same whether you load them into your toolbox via the C1ControlPanel or via NuGet. When you drag and drop a control from the toolbox onto the artboard of the XAML, it checks for a C1 license on your machines and creates a 30-day trial key if it doesn’t find one. Then it creates or updates the licenses.licx for that control.

While NuGet can update the version of the controls referenced in your application, it cannot update your project’s licenses.licx. This may lead to a potential mismatch resulting in an evaluation nag screen. We provide tools in our GrapeCity License Manager that resolve these issues.

Find more information about managing your licenses with ComponentOne controls here.

We hope this gives you a good introduction to the NuGet Package Manager.

If you have any questions, please feel free to leave a comment below.

Andy Paxinos

Junior Product Manager
comments powered by Disqus