DEV Community

Cover image for Easily Add .NET Core 3.1 and .NET 5.0 Custom Controls to Visual Studio Toolbox
Suresh Mohan for Syncfusion, Inc.

Posted on • Originally published at syncfusion.com on

Easily Add .NET Core 3.1 and .NET 5.0 Custom Controls to Visual Studio Toolbox

This blog explains the procedure to add .NET Core 3.1 and .NET 5.0 custom controls to your Visual Studio toolbox. This custom toolbox controls configuration is supported by Visual Studio via NuGet packages.

There are two methods for configuring custom controls in the Visual Studio toolbox:

Without manually installing NuGet packages

Toolbox items will be automatically populated in the Visual Studio toolbox without the need for each project to have the NuGet packages installed.

It’s as simple as that; follow these steps, as directed by Microsoft:

  1. First, create a NuGet package that includes your custom assembly as well as the tools\VisualStudioManifest.xml file.
  2. Then, use the following command to expand your NuGet package and place it in the NuGet fallback folder (Create a new directory in your disc anywhere to use it as a fallback folder).

| nuget.exe add <path to your nupkg> -Source <path to your fallback folder> -Expand |

  1. Now, create a config file in the following structure and update the previous NuGet fallback folder path. Refer to the following code example.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <fallbackPackageFolders>
    <add key="Syncfusion Toolbox Local NuGet Packages 19.1.0.63" value="C:\Program Files (x86)\Syncfusion\Essential Studio\WPF\19.1.0.63\ToolboxNuGetPackages" /> </fallbackPackageFolders>
</configuration>
Enter fullscreen mode Exit fullscreen mode
  1. Then, save it in the following location. An example of a config file’s location: Location: %ProgramFiles(x86)%\NuGet\Config\FileName.config Example: C:\Program Files (x86)\NuGet\Config\Syncfusion Toolbox for WPF.config In the previous code,
    • Syncfusion Toolbox Local NuGet Packages 19.1.0.63 – This is a unique key to identify your package. You can replace it with your own.
    • C:\Program Files (x86)\Syncfusion\Essential Studio\WPF\19.1.0.63\ToolboxNuGetPackages – This is a fallback folder. You can replace it with the expanded fallback folder from your NuGet package.
  2. In the Visual Studio v16.7 Preview 2 or later , create a .NET Core 3.1.NET 5.0 project. Then, open the designer page. Now, the toolbox items defined in the tools\VisualStudioManifest.xml file will be displayed in your toolbox.
  3. To work with your controls, double-click or drag and drop one from the toolbox into your designer page.

From our Syncfusion 2021 Volume 1 release onward, we are providing automatic toolbox configuration support for WPF .NET 5.0 controls. You can just download and install our Essential Studio for WPF setup v19.1.0.54 or later in a .NET 5.0-enabled machine. Then, the Syncfusion WPF .NET 5.0 controls will be automatically listed in the toolbox.

Syncfusion WPF UI controls in VS 2019 toolbox tab
Syncfusion WPF UI controls in VS 2019 toolbox tab

Reference

Refer to the following user guide documentation:

Limitations

  • The automatic toolbox configuration for .NET Core 3.1 or .NET 5.0 is supported only in Visual Studio v16.7 Preview 2 or later.
  • It is now limited to WPF .NET Core projects and packages.

By installing NuGet packages

You can also get your custom controls in the Visual Studio toolbox by installing the NuGet packages. To do so, follow these steps:

  1. First, create a NuGet package that includes your custom assembly as well as the tools\VisualStudioManifest.xml file.
  2. Then, install this NuGet package to your WPF project.
  3. Now, the toolbox items defined in the tools\VisualStudioManifest.xml file will be displayed in the toolbox.
  4. To work with your controls, double-click or drag and drop one into your designer page.

Note: Refer to configuring custom controls in the toolbox in Visual Studio 2017 v15.0 or later using referenced NuGet packages.

Limitations

  • This necessitates manually installing the NuGet packages in each project. Uninstalling the NuGet package, will remove the toolbox items as well.
  • This type of configuration is project-specific. If installed in a single project, toolbox items will only be listed in that project. They will not be present in other projects.

Conclusion

Thanks for reading! In this blog, we have seen the procedure to add .NET Core 3.1 and .NET 5.0 custom controls to your Visual Studio toolbox. This will populate the required controls in the toolbox and ease the process of development. So, try out these steps and leave your feedback in the comments section given below!

Syncfusion provides 70+ high-performance, lightweight, modular, and responsive ASP.NET Core UI controls such as DataGrid, Charts, and Scheduler. You can use them to improve your application development.

For existing customers, the new version is available for download from the License and Downloads page. If you are not yet a Syncfusion customer, you can try our 30-day free trial to check out our available features. Also, try our samples from this GitHub location.

You can also contact us through our support forum, Direct-Trac, or feedback portal. We are always happy to assist you!

Related blogs

Top comments (0)