Configuring a NuGet package to create a new project

Topics: General
Dec 16, 2012 at 9:47 AM

Hello,

I would like to create a NuGet package with sample project that can be used to help understanding how to use another NuGet package. So basically what I want to achieve is that when developers will install this package (e.g. Install-Package MySample), the following steps will be executed:

  • a new project will be created in the solution.
  • referenced NuGet packages for this new project will be downloaded.

As I understand I will have to create a solution-level package. I've found on StackOverflow a post where one of the comments touches this issue, but I wonder if there are some examples of how to achieve this.

Thanks in advance

Dec 20, 2012 at 2:26 AM
Edited Dec 20, 2012 at 2:58 AM

Hello object,

I'm unaware of a NuGet package that has done exactly what you describe.  That doesn't mean it's impossible, though.

First, let me tell you the bad news:  The code in the linked SO post won't do exactly what you want; it will create a solution-level folder rather than an additional project.  However, with some finessing, you ought to be able to create a PowerShell script that does what you want. 

If this doesn't work out -- and let us know if it doesn't -- you might want to take a look at how we structured our VB template NuGet packages (see Bakery.Template.VB2 for example) as an alternative.

Good luck,
Clay

 

 

Dec 20, 2012 at 5:37 AM

Thanks Clay,

So it looks that this scenario is not something that works out of the box. I see. I will check out the template you mentioned and try to figure it out.

Best regards

Vagif Abilov

aka object