Click here to Skip to main content
15,907,497 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a NuGet package containing a WPF user control in VS 2022 and I just can't figure out how to get the control to appear in the toolbox of the consumer application. I used the Pack command from the drop down menu of the user control project to create the NuGet package on my local PC then from another application consumed the NuGet package. Unfortunately the user control did not appear in the toolbox. Thankyou.

The only reference I discovered was this from Microsoft https://learn.microsoft.com/en-us/nuget/guides/create-ui-controls which was really incomplete, as usual, and does not coincide with the file structure of VS 2022, etc...

What I have tried:

I have tried creating a simple user control with a button and textbox in a WPF control library project in VS 2022 and running Pack from the context menu dropdown from right clicking on the project.

From another instance of VS 2022 I created a consumer WPF app to reference the nuget package which appears and is added but the user control does not appear in the toolbox.
Posted

1 solution

To build a NuGet with visible user control in the toolbox of the consumer app, make sure your UI project is configured to build a NuGet on the build. In your UI project, include the assembly references and package metadata, as well as the user control XML file. Once the package is built, consumers will be able to install it through NuGet. The user control should automatically be added to the consumer app toolbox for easy integration into their apps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900