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

Converting extension SDKs into NuGet Packages #3509

Closed
harikmenon opened this issue Sep 23, 2016 · 16 comments
Closed

Converting extension SDKs into NuGet Packages #3509

harikmenon opened this issue Sep 23, 2016 · 16 comments
Milestone

Comments

@harikmenon
Copy link

Details for the spec available here

https://github.com/NuGet/Home/wiki/Converting-Extension-SDKs-into-NuGet-Packages

@rrelyea rrelyea added this to the 3.6 RC milestone Sep 30, 2016
@rrelyea rrelyea modified the milestones: 3.6 RC2, 3.6 RC Oct 20, 2016
@rrelyea rrelyea modified the milestones: 4.0 RC2, 4.0 RC3 Nov 29, 2016
@rrelyea rrelyea modified the milestones: 4.0.1, 4.0 RC3 Jan 6, 2017
@jnm2
Copy link

jnm2 commented Oct 17, 2017

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?

@debonte
Copy link

debonte commented Oct 17, 2017

Thanks for the suggestion @jnm2. I'll pass this on to the Winforms team.

@jnm2
Copy link

jnm2 commented Oct 17, 2017

Thank you. This is causing pain as my company is migrating many internal libraries from shared projects to internal NuGet packages.

@jnm2
Copy link

jnm2 commented Nov 28, 2017

I've gotten so close to having an okay workaround!

  • Choose a target framework and copy the lib DLL to /tools/design
  • Copy any dependency assemblies it needs to the same nupkg directory so that it can be loaded at design time
  • Add this file as /tools/Init.ps1

Result (only tested with <PackageReference>):

  • The first time you install the package from the package manager, the toolbox gets set up the way you'd want it. VS saves the toolbox state when it closes.
  • Adding a control to a form does the right thing to your project references (nothing) if you have a package reference. However if you beat VS to package restore (not likely unless you're trying), you can totally trash your project references.
  • If you didn't use the package manager, or you delete the toolbox items and want them back, you have to go the the menu and choose View > Other Windows > Package Manager Console. This will cause 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:

  1. 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.

  2. 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.

@jainaashish
Copy link
Contributor

Done in Visual Studio 2017 15.2

@jainaashish jainaashish modified the milestones: Future-0, 4.0.2 Nov 30, 2017
@MikhailTymchukDX
Copy link

MikhailTymchukDX commented Jan 10, 2018

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>

@debonte
Copy link

debonte commented Jan 10, 2018

@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

@ghost
Copy link

ghost commented Apr 20, 2018

Are there any updates on this issue? I'm still needing to have Controls automatically added to the Visual Studio Toolbox.

@debonte
Copy link

debonte commented Apr 20, 2018

@jasonpezzimenti Not sure what you're referring to. WinForms support?

@jnm2
Copy link

jnm2 commented Apr 20, 2018

@debonte Yes, I believe he is. I'm also anxious to hear from the WinForms team.

@ghost
Copy link

ghost commented May 1, 2018

@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.

@Misiu
Copy link

Misiu commented Oct 31, 2018

@jainaashish any news about WinForms support?

@jainaashish
Copy link
Contributor

@anangaur @karann-msft can you help answer this?

@jainaashish
Copy link
Contributor

@Misiu can you please follow on #6440 which is the current issue targeting this winforms support ask?

@debonte
Copy link

debonte commented Oct 31, 2018

@mgoertz-msft, can you answer this?

@mgoertz-msft
Copy link

I provided an answer in #6440

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants