What is the recommended way of adding components downloaded from nuget to toolbox?

青春壹個敷衍的年華 提交于 2019-12-07 17:55:46

问题


I have a C# Windows Forms project in which I use a component that I obtained through nuget. Now I was wondering what is the correct way of adding this component to the toolbox in the designer. Should I make a separate copy of the component on my hdd and add it from there or should I just add it from the project's packages folder or maybe do something different entirely?

I was wondering if:

  • having a separate copy of the component won't cause problems if I use a newer version of the component in another project?
  • using the copy from packages folder and then deleting, moving the project, won't that cause problems with the toolbox?

回答1:


Based on the conversation I had with Hans Passant in the comments (since he didn't post it as an answer):

Normally, when you get a windows forms component from nuget, it will automatically get added to the designers toolbox. The only time when it should not happen is when "Automatically Populate Toolbox" is set to false (Tools > Options > Windows Forms Designer > General).

In my particular case this does not happen. It might be related to "non-trivial dependencies that cannot be found at design time". But I'm not entirely sold on that, because I remember not being able to use such components in the designer at all, however the component that lead me to asking this question can be used there just fine. However this is likely material for a different question (and possibly on a different site).



来源:https://stackoverflow.com/questions/29049379/what-is-the-recommended-way-of-adding-components-downloaded-from-nuget-to-toolbo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!