I want to create a Visual Studio 2010 Project Template, which is essentially a ASP.net 3.5 Webforms Application.
However, I would like to automatically add a NuGet Package Reference. I can bundle the actual nupkg with the template if needed, but I wonder if it's possible to instead run the Install-Package command to always retrieve the latest version when creating a new Project? (I can guarantee that future versions never break the template)
Is that possible? I only made small changes to Project Templates so far, so I don't know exactly where I would start. I found some stuff for MVC 3, but as said, I'm on Webforms (and .net 3.5).
Drop your NuGet package files in that folder. Go to your Project in Solution Explorer, right click and select "Manage NuGet Packages". Select your new package source.
You can create a custom template for it, however it won't be fetched from the web, it'll only copy from your local disk (though maybe this will change in the future). Phil Haack wrote an article about this on his blog recently:
There are two major limitations:
- The package must exist in the %ProgramFiles%\Microsoft ASP.NET\ASP.NET MVC 3\Packages folder. MVC 3 doesn’t go searching online for them.
- The version attribute of the package in the element is required and is an exact match.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With