Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please allow extension SDK manifests to light up for Windows Forms also #6440

Closed
jnm2 opened this issue Jan 15, 2018 · 34 comments
Closed

Please allow extension SDK manifests to light up for Windows Forms also #6440

jnm2 opened this issue Jan 15, 2018 · 34 comments
Labels
Functionality:SDK The NuGet client packages published to nuget.org Resolution:Duplicate This issue appears to be a Duplicate of another issue Resolution:External This issue appears to be External to nuget Type:Feature

Comments

@jnm2
Copy link

jnm2 commented Jan 15, 2018

The toolbox can automatically display XAML controls from referenced NuGet packages via extension SDK manifests. It would be amazing if the same behavior lit up for Windows Forms projects too:

<?xml version="1.0" encoding="utf-8"?>
<FileList>
  <File Reference="CompanyName.LibraryName.dll">
    <ToolboxItems VSCategory="CompanyName LibraryName (2.1.0-rc)">
      <Item Type="LibraryNamespace.ControlName" />
    </ToolboxItems>
  </File>
</FileList>

This current lack in Visual Studio has been an ongoing issue as my company has migrated from shared projects to NuGet packages for our own internal controls. I eventually came up with a workaround (detailed at #3509 (comment)) which does install tools into the toolbox automatically. It's not perfect but it's a lifesaver. It's a shame that we're forced to use such a dubious workaround though.

NuGet has recently become a popular distribution model for DevExpress's many Windows Forms controls as well. I've gathered that you worked with Telerik on the XAML control distribution model. The NuGet/toolbox work seems to be mostly done. It would make sense to afford the same convenience to DevExpress customers who use Windows Forms.

Would you please consider this?

@PatoBeltran
Copy link

@anangaur could you please take a look at this issue?

@PatoBeltran PatoBeltran added Functionality:SDK The NuGet client packages published to nuget.org Type:DCR Design Change Request labels Jan 17, 2018
@anangaur
Copy link
Member

/cc: @karann-msft

@ghost
Copy link

ghost commented Apr 20, 2018

Are there any updates on this? I've built several controls for Windows Forms and I need to have them automatically added to the Visual Studio Toolbox.

@sansjunk
Copy link

Any updates on this? I am looking for this feature as well.

@jnm2
Copy link
Author

jnm2 commented Jul 23, 2018

I'm using Visual Studio 15.8 Preview 4 and I'm not sure what I'm seeing, but the toolbox is behaving very differently! Is work being done in 15.8 to discover Windows Forms toolbox items in package references?

@karann-msft karann-msft self-assigned this Aug 29, 2018
@Misiu
Copy link

Misiu commented Oct 31, 2018

@karann-msft any news about this feature? It would be awesome to finally be able to share controls via NuGet (and have them in Toolbox).

@jainaashish jainaashish added Type:Feature and removed Type:DCR Design Change Request labels Oct 31, 2018
@mgoertz-msft
Copy link

We did add support for WinForms in 15.8 (and fixed a few bugs in 15.9). However, it does not use the manifest but does it the traditional WinForms way showing all IComponent derived controls and using attributes to control the behavior:

Hide Controls
[ToolboxItem(false)]
[DesigntimeVisible(false)]

Category Name
[assembly: AssemblyProduct("My Controls")]

Tooltip Description
[Description(“What my control does”)]

@jnm2
Copy link
Author

jnm2 commented Nov 1, 2018

@mgoertz-msft Even better than the manifest, I think! Thanks! I noticed that no icons are showing up in the toolbox for components discovered this way. Will that be fixed?

@mgoertz-msft
Copy link

No plans at the moment. Icon support will be a little harder since we don't actually load the assemblies and therefore cannot get to the embedded resources where the icons usually are.

@jnm2
Copy link
Author

jnm2 commented Nov 2, 2018

I see, too bad. Looks like you'd need https://github.com/dotnet/corefx/issues/23372.

@mgoertz-msft
Copy link

Yes, that would help. Of course I would need that on .NET Framework and not just Core.

@Misiu
Copy link

Misiu commented Nov 4, 2018

@mgoertz-msft thanks for the update, I'll try that right away.
Icon support isn't that important, but it would be a cherry on top :)

After adding a class that inherits Control everything works fine - control shows in the toolbox, but category name is the name of my NuGet package. I cannot change the category name.
I've tried adding [assembly: AssemblyProduct("Test")] attribute to my class but in VS 15.8.9 I get this warning:
vs_nuget_controls

Is this feature somewhere documented? Or maybe there is a sample NuGet package we can check as a reference?

@jnm2
Copy link
Author

jnm2 commented Nov 6, 2018

@Misiu An attribute can't target both an assembly and a class. If it has assembly:, it's assembly-wide. (docs)

@jnm2
Copy link
Author

jnm2 commented Nov 6, 2018

@mgoertz-msft I'm interested in the ability to keep design-time assemblies in the nupkg, both as a producer of multiple Windows Forms libraries and as a customer of DevExpress who I wish would also be able to use this.

The company I work with has had issues with the design-time assemblies being resolved through HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.5.50709\AssemblyFoldersEx\Foo because they conflict with the newer runtime assemblies referenced via NuGet. It would be better to version the design-time assemblies within the nupkg along with their matching runtime assemblies. Maybe the convention could be to keep them under design/net46, etc?

If this isn't something you're already working on, may I open a new issue?

@Misiu
Copy link

Misiu commented Nov 6, 2018

@jnm2 thanks for the hint, now it works fine 😄
P.S.
Do You know how to add information about version and company like in .NET Controls?
toolbox_control

@jnm2
Copy link
Author

jnm2 commented Nov 6, 2018

@Misiu Yes. So long as our Windows Forms projects require us to use the legacy csproj format and there's no way to set this in the csproj, you use the AssemblyInfo.cs file:

// Shows up as company in Windows Explorer file properties
[assembly: AssemblyCompany("Misiu Corp.")]

// Shows up as product name in Windows Explorer file properties
[assembly: AssemblyProduct("Misiu.Controls")]

// Shows up as copyright in Windows Explorer file properties
[assembly: AssemblyCopyright("Copyright © 2018 Misiu Corp.")]

// Sets .NET assembly version and shows up as file version in Windows Explorer file properties
[assembly: AssemblyVersion("1.2.3")]

// Shows up as product version in Windows Explorer file properties
// Right now it's redundant because it defaults to AssemblyVersion, but I have a build script that
// modifies this one to 1.2.3+build.5678.commit.e6e24391d in CI.
[assembly: AssemblyInformationalVersion("1.2.3")]

// Shows up as Windows Explorer file description and as "Open with" description if this was an EXE
[assembly: AssemblyTitle("Misiu user interface components")]

If you have multiple projects in your solution that ship to production, I'd suggest putting only AssemblyTitle in each AssemblyInfo.cs and putting the rest in a CommonAssemblyInfo.cs file next to the solution, and linking that file in under the Properties folder of each csproj. (To link, drag the file into Solution Explorer and hold Ctrl+Shift while letting go.)

@Misiu
Copy link

Misiu commented Nov 6, 2018

@jnm2 I have all of those in my AssemblyInfo.cs but after building m NuGet and adding it to test project I see my user control, but after hovering on Toolbox I don't see version and company info.
Try hovering over one of the standard (built-in) controls and then on Your custom control. You will see an additional line:
Version 4.6.1.0 from Microsoft Corporation (just like on image from my previous comment).

I want to add Version 1.2.3 from Misiu Corp. to all of my controls and would like to have that when I hover over control in Toolbox.

Not sue if this is possible when sharing controls via NuGet.

@jnm2
Copy link
Author

jnm2 commented Nov 6, 2018

Oh, I see. I'm not sure I can answer that. @mgoertz-msft?

@Misiu
Copy link

Misiu commented Apr 18, 2019

@jnm2, @mgoertz-msft could You take a look at this: https://github.com/dotnet/corefx/issues/23372#issuecomment-484481574?
How are icons read right now when controls are selected from DLL? Is there any potential risk to do that at runtime?

@mgoertz-msft
Copy link

@Misiu Sorry, this had dropped off my radar. It looks like Version is already supported for NuGet assemblies but Company name is not. This is what shows up for the WebView control:

WebViewToolboxTooltip

@Misiu Just like with the icon request, I would suggest that you create a feedback ticket for this through VS so it gets tracked in our work item tracking system in VS. That way it can also get upvoted, which would increase the priority of this investigation. Please mention my name somewhere in the description or add the link here so I can find it and make sure it ends up in the right spot.

@Misiu
Copy link

Misiu commented Apr 19, 2019

@mgoertz-msft I've created a feature request for Company attribute: https://developercommunity.visualstudio.com/idea/539607/support-company-attribute-for-user-controls-instal.html
and for icon support: https://developercommunity.visualstudio.com/idea/539616/user-controls-installed-via-nuget-should-display-i.html

Please moderate them if needed. Hopefully, this will be added at some point, ideally to VS2019 and VS2017.
I think that not only big players (DevExpress, Telerik, Syncfusion, etc) will be happy with those improvements 🙂

@mgoertz-msft
Copy link

@Misiu Got them, thank you! No promises though on if or when these will be addressed but at least we have them in Visual Studio's tracking system now, which will notify you of any changes to these tickets.

@Kannan1015
Copy link

@mgoertz-msft , the .NET Framework assemblies are loaded in the Visual Studio 2019 toolbox when installing the NuGet package. But, the custom control is not configured in toolbox for .NET Core 3.0 WinForms application. Do we have the solution for this?

@nkolev92
Copy link
Member

Walking through this thread, are there any asks from NuGet that are not captured in other issues?
@mgoertz-msft

@nkolev92 nkolev92 added WaitingForCustomer Applied when a NuGet triage person needs more info from the OP Resolution:External This issue appears to be External to nuget and removed WaitingForCustomer Applied when a NuGet triage person needs more info from the OP Pipeline:New Issues labels Apr 17, 2020
@nkolev92
Copy link
Member

Duplicate of https://github.com/dotnet/winforms-designer/issues/202.

Please track that effort there.

Thank you all.

@nkolev92 nkolev92 added the Resolution:Duplicate This issue appears to be a Duplicate of another issue label Apr 18, 2020
@jnm2
Copy link
Author

jnm2 commented Apr 18, 2020

@nkolev92 https://github.com/dotnet/winforms-designer/issues/202 gives me a 404. Can there be a public thread to track, please?

@nkolev92
Copy link
Member

Oh my bad.
I've reached out to people on the team for input on that.

@ilCosmico
Copy link

The issue about icon support when a custom control .net framework is added via NuGet package is still here. I tested it with the latest versions of Visual Studio 2022 (17.7.3).
Here is another post about it.

Here is a ready-to-use sample project that can be used to reproduce the issue.
MyControlWinForms.zip
image

@tbolon
Copy link

tbolon commented Sep 13, 2023

The issue about icon support when a custom control .net framework is added via NuGet package is still here. I tested it with the latest versions of Visual Studio 2022 (17.7.3). Here is another post about it.

Here is a ready-to-use sample project that can be used to reproduce the issue. MyControlWinForms.zip image

There seems to be two errors in your screenshot:

  • Resources should be alongside the control, so not in Resources sub-directory (or you have to give the full path of the resource as the second parameter of ToolboxBitmap attribute)
  • Icons should be in a bmp (with magenta as transparency color) or ico file

See https://learn.microsoft.com/en-us/dotnet/desktop/winforms/controls-design/how-to-set-toolbox-icon?view=netdesktop-7.0 for reference. The steps are still the same since .NET Framework.

@ilCosmico
Copy link

ilCosmico commented Sep 13, 2023

@tbolon I tried the suggestions you provided, but unfortunately, it doesn't seem to be working. :(

Please, have a look at the updated sample project here.

P.S. In .Net Framework documentation, I cannot see any reference to "magenta as transparency color".

@tbolon
Copy link

tbolon commented Sep 14, 2023

@tbolon I tried the suggestions you provided, but unfortunately, it doesn't seem to be working. :(

My bad, displaying icons for controls inside nuget package is only supported when using the new out-of-proc designer. When using the legacy winforms designer, only the default icon will be used.

@ilCosmico
Copy link

My bad, displaying icons for controls inside nuget package is only supported when using the new out-of-proc designer. When using the legacy winforms designer, only the default icon will be used.

No problem. Fact is that Microsoft stated that the issue was solved, but it's not so.
Please, upvote here to make you forgiven :)

@tbolon
Copy link

tbolon commented Sep 14, 2023

My bad, displaying icons for controls inside nuget package is only supported when using the new out-of-proc designer. When using the legacy winforms designer, only the default icon will be used.

No problem. Fact is that Microsoft stated that the issue was solved, but it's not so. Please, upvote here to make you forgiven :)

The discussion linked is closed.

I have tried to create a full summary of what is supported or not depending of the designer used, see my conclusions here: https://github.com/tbolon/winforms-playground/tree/main/ToolboxTests/PackageRefApps

Perhaps we should create issues or feedback on VS hub to track these features?

@ilCosmico
Copy link

ilCosmico commented Sep 14, 2023

I have tried to create a full summary of what is supported or not depending of the designer used, see my conclusions here: https://github.com/tbolon/winforms-playground/tree/main/ToolboxTests/PackageRefApps

Great!

Perhaps we should create issues or feedback on VS hub to track these features?

Already done here, but it was closed :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:SDK The NuGet client packages published to nuget.org Resolution:Duplicate This issue appears to be a Duplicate of another issue Resolution:External This issue appears to be External to nuget Type:Feature
Projects
None yet
Development

No branches or pull requests