Details for the spec available here
https://github.com/NuGet/Home/wiki/Converting-Extension-SDKs-into-NuGet-Packages
It would be amazing if this lit up for Windows Forms projects too:
<?xml version="1.0" encoding="utf-8"?>
<FileList>
<File Reference="CompanyName.Controls.dll">
<ToolboxItems VSCategory="CompanyName">
<Item Type="CompanyName.Controls.ControlName" />
</ToolboxItems>
</File>
</FileList>
Would you please consider this?
Thanks for the suggestion @jnm2. I'll pass this on to the Winforms team.
Thank you. This is causing pain as my company is migrating many internal libraries from shared projects to internal NuGet packages.
I've gotten so close to having an okay workaround!
/tools/design/tools/Init.ps1Result (only tested with <PackageReference>):
Init.ps1 to run and the items to be inserted into the toolbox.Init.ps1 is a super ugly hack and I should not be forced into doing this, but this is the state of the art with Windows Forms and NuGet. Please let Windows Forms controls be autodiscovered via PackageReference just like you already do with XAML controls.
Potential improvements to the hack:
Add a .props that uses InitialTargets to obtain a DTE reference and run Init.ps1 so that you no longer have to go the the menu and choose View > Other Windows > Package Manager Console to get Init.ps1 to run if you need fix the toolbox. Yup, this is ugly too, but not as ugly as having to open the package manager console to get intuitive behavior from the toolbox.
Instead of using the $DTE object already present, read the whole running object table and repeat the toolbox item installation for every open instance of VS. The last VS instance to close overwrites the whole toolbox, so if you install the NuGet package in only one of them and then close it before closing the other one, the toolbox items are gone and you have to repair it (see improvement 1 for autorepair)
Improvement 2 is debatable. This is all stuff VS should be doing; there's no way to remove the toolbox items when you open a project that doesn't reference the package, even though you really should.
Done in Visual Studio 2017 15.2
The code sample in wiki has error:
<FileList>
<File Reference = “YourReferenceAssembly.winmd”>
<ToolboxItems VSCategory = “YourFolderName” BlendCategory=" YourFolderName">
<Item Type="Namespace.Type1" />
<Item Type="Namespace.Type2" />
<Item Type="Namespace.TypeEtc" />
<ToolboxItems/>
</File>
</FileList>
ToolboxItems tag improperly closed. The valid code is the following:
<FileList>
<File Reference = "YourReferenceAssembly.winmd">
<ToolboxItems VSCategory = "YourFolderName" BlendCategory=" YourFolderName">
<Item Type="Namespace.Type1" />
<Item Type="Namespace.Type2" />
<Item Type="Namespace.TypeEtc" />
</ToolboxItems>
</File>
</FileList>
@MikhailTymchukDX, that's the feature spec and as a spec might have errors. The final documentation is available here: https://docs.microsoft.com/en-us/nuget/guides/create-uwp-controls
Are there any updates on this issue? I'm still needing to have Controls automatically added to the Visual Studio Toolbox.
@jasonpezzimenti Not sure what you're referring to. WinForms support?
@debonte Yes, I believe he is. I'm also anxious to hear from the WinForms team.
@debonte Sorry for the delay, I am referring to that. It would be awesome if we could finally have Toolbox support for Windows Forms controls.
@jainaashish any news about WinForms support?
@anangaur @karann-msft can you help answer this?
@Misiu can you please follow on https://github.com/NuGet/Home/issues/6440 which is the current issue targeting this winforms support ask?
@mgoertz-msft, can you answer this?
I provided an answer in #6440
Most helpful comment
It would be amazing if this lit up for Windows Forms projects too:
Would you please consider this?