简体   繁体   中英

Visual studio multi project template restore all nuget packages

I´m strugling around for some days with visual studio multi project templates installed by an vsix plugin.

What I tried: Stackoverflow 1 AND TONS OF MSDN ARTICLES

The problem/what I want to do:

  1. Setup a private nuget feed for visual studio in general.
  2. Install packages from this feed to the subprojects

I thought about using the nuget package restore command, because all the subprojects have their packages.config files but I have no plan how to run that command after the project was created. Is there a way to start eg a powershell script that perform such tasks for me?

thanks & greetings Nico

If this is part of your own custom VSIX extension, you might want to consider using NuGet via C# itself via NuGet.Core or NuGet.VisualStudio .

You could create your own IWizard and list the packages in the <WizardData> element in your MyTemplate.vstemplate definition file.

Although it is using the official NuGet v2 URL, I took this approach to make sure when ever users create a new ServiceStack project via ServiceStackVS, it installs the latest version across all the projects.

The NuGetPackageInstallerMultiProjectWizard class is for use on multi-project templates and checks for the latest version of a specific NuGet dependency specified in the <WizardData> of the parent template. While the NuGetPackageInstallerWizard is responsible for actually installing the NuGet dependency.

So if you know the URL users will need to use for the required NuGet packages you could take a similar approach.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM