Hi,
We would like to create a nuget package for our code (.net core 3.1). However it appears that the alternet ui controls are added to the vs toolbox. How do I prevent the alternet controls from showing up?
To be clear
OurPackage depends on Alternet.Studio.Scripter.Debugger.UI.WindowsForms and Alternet.Studio.Editor.Roslyn.
When consuming “OurPackage” in a new solution, the alternet ui controls are visible in the VS ToolBox.
I have tried the following without luck.
compile
compile
Repo steps,
- Create new project e.g. OurPackage in vs2019
- Add nuget packages Alternet.Studio.Scripter.Debugger.UI.WindowsForms and Alternet.Studio.Editor.Roslyn
- Right-click “Pack” OurPackage
- Consume that pack in a new solution
Thanks,
Rob
Hi,
I investigated into this issue, and it seems that PackageReference
project file element has some controls over how dependency packages effects are propagated to “parent” projects. Is uses IncludeAssets
/ExcludeAssets
/PrivateAssets
for that. See more about it here:
https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#controlling-dependency-assets
There, you can see values like compile
, analyzers
, etc. However, there is no tag value for designer toolbox population control. Setting PrivateAssets
to all
would help the toolbox issue, but that would effectively stop the Alternet assemblies from being copied to the application’s output directory, so that would not fit our needs.
Also a similar issue (but concerning DevExpress controls) apparently has been raised on Visual Studio support site:
https://developercommunity.visualstudio.com/t/toolbox-loads-all-devexpress-controls/317122
However, the only workaround suggested by MS support was:
via Tools->Options->Windows Forms Designer->Toolbox by setting Automatically Populate Toolbox to False.
This will turn off the NuGet toolbox auto-population for all packages altogether. Otherwise, that ticket was closed as “Lower Priority”.
I have created a new Visual Studio support ticket stating this problem here:
https://developercommunity.visualstudio.com/t/how-to-stop-visual-studio-toolbox-from-being-auto/1367122
In case I get any helpful feedback from MS, I will let you know in this thread.
1 Like
Managed to workaround it by creating a new nuget package that manually includes the alternet.* dlls, and a VisualStudioToolsManifest.xml which has the following contents.
<FileList>
<File Reference="Alternet.Common.v7.dll">
<ToolboxItems UIFramework="WinForms" VSCategory="this-does-not-show-up-but-is-needed-to-exclude-toolboxitems">
</ToolboxItems>
</File>
<File Reference="Alternet.Editor.Common.v7.dll" >
<ToolboxItems UIFramework="WinForms" VSCategory="this-does-not-show-up-but-is-needed-to-exclude-toolboxitems">
</ToolboxItems>
</File>
etc.