I have been following this post about how to build a VSIX project that will add some custom MVC project types:
http://www.asp.net/mvc/tutorials/mvc-4/custom-mvc-temp
To download latest versions of NuGet packages plus all their dependencies add a following class to your vsix:
public class MyProjectWizard : IWizard
{
IEnumerable _packages;
public void RunStarted(object automationObject, Dictionary replacementsDictionary, WizardRunKind runKind, object[] customParams)
{
if (customParams.Length > 0) {
var vstemplate = XDocument.Load((string)customParams[0]);
_packages = vstemplate.Root
.ElementsNoNamespace("WizardData")
.ElementsNoNamespace("packages")
.ElementsNoNamespace("package")
.Select(e => e.Attribute("id").Value)
.ToList();
}
}
public void ProjectFinishedGenerating(Project project)
{
var componentModel = (IComponentModel)Package.GetGlobalService(typeof(SComponentModel));
var _installer = componentModel.GetService();
foreach (var package in _packages) {
_installer.InstallLatestPackage(null, project, package, false, false);
}
}
}
And then use following in vstemplate:
MyProjectWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=22c2a1a5fa7b6905
MyProjectWizard.MyProjectWizard