1

I have an open source Windows Form Control that is available for everyone to use via NuGet, however, this control depends on one of my other libraries for handling the animations.

Now the problem is that user won't see the control in the toolbox after adding the NuGet package and in fact, they can't even add the control manually because of its dependent to the other library and the fact that two libraries are in different folders.

So the question is, is there a better way to add a control to the Toolbar from a NuGet package? As for now, they need to compile their project once and then add the library from the /bin/Debug or /bin/Release folder to the toolbar.


The library in question is:

https://github.com/falahati/CircularProgressBar

Soroush Falahati
  • 2,196
  • 1
  • 27
  • 38
  • Related: http://stackoverflow.com/questions/37672233/how-to-automatically-add-components-from-a-nuget-package http://stackoverflow.com/a/29060299/495455 and this which indicates you have to do it manually: https://forum.patagames.com/posts/t9-How-to-add-a-PdfView-control-to-the-Toolbox I've found articles for WPF and also UWP Controls not WinForms. – Jeremy Thompson May 15 '17 at 04:29
  • The adding process is ok if the component has no dependency. However, it seems that NuGet is not build to handle these dependency scenarios and Designer Toolbar don't actually follow the added references to the project and as result, it won't be able to add the control to the toolbar as the other library is no next to the downloaded NuGet package. I wanted to know if NuGet offers another way to put the dependent library next to the main library. – Soroush Falahati May 16 '17 at 07:30

1 Answers1

2

It seems NuGet is not built to handle these dependency scenarios and Designer Toolbox doesn't actually follow the added references to the project, as result it won't be able to add the control to the toolbox.

Given the situation that a dependency is causing the problem, it appears to be by-design (or unsupported).

I wanted to know if NuGet offers another way to put the dependent library next to the main library.

Have you tried to work around it by merging the 2 assemblies together. The tool ILMerge from Microsoft allows you to do just that. Here we merge Primary.dll Secondary.dll (and etc) into Merged.dll with a log.txt out of the merger.

ilmerge /log:log.txt /out:Merged.dll Primary.dll Secondary.dll 
Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
  • Well, I didn't try that, but for a good reason, what would happen if user wants to use the other library in his project as well? Then we would have duplicate reference problem. Is this possible to change the namespace or make all classes internal with ilmerge? So I can merge an internal copy of the library? – Soroush Falahati May 16 '17 at 08:50
  • Try using ILSpy on the merged assembly and save out as a c# project. – Jeremy Thompson May 16 '17 at 08:53
  • I accepted your answer, however, I probably going to leave it as it is now and ask users to add the library to the toolbar. This just makes everything unnecessarily complicated. – Soroush Falahati May 18 '17 at 11:17