[英]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. 我花了几天的时间来研究由vsix插件安装的Visual Studio多项目模板。
What I tried: Stackoverflow 1 AND TONS OF MSDN ARTICLES 我试过的: Stackoverflow 1和MSDN文章的大量内容
The problem/what I want to do: 问题/我想做什么:
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. 我考虑过使用nuget package restore命令,因为所有子项目都有其packages.config文件,但是我没有计划在创建项目后如何运行该命令。 Is there a way to start eg a powershell script that perform such tasks for me?
有没有办法启动例如为我执行此类任务的Powershell脚本?
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 . 如果这是您自己的自定义VSIX扩展的一部分,则可能要考虑通过NuGet.Core或NuGet.VisualStudio通过C#本身使用NuGet。
You could create your own IWizard and list the packages in the <WizardData>
element in your MyTemplate.vstemplate
definition file. 您可以创建自己的IWizard,并在
MyTemplate.vstemplate
定义文件的<WizardData>
元素中列出软件包。
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. 尽管它使用的是正式的NuGet v2 URL,但我还是采用这种方法来确保用户每次通过ServiceStackVS创建新的ServiceStack项目时,都会在所有项目中安装最新版本。
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. NuGetPackageInstallerMultiProjectWizard
类用于多项目模板,并检查在父模板的<WizardData>
中指定的特定NuGet依赖项的最新版本。 While the NuGetPackageInstallerWizard
is responsible for actually installing the NuGet dependency. NuGetPackageInstallerWizard
负责实际安装NuGet依赖项。
So if you know the URL users will need to use for the required NuGet packages you could take a similar approach. 因此,如果您知道URL用户将需要使用所需的NuGet软件包,则可以采取类似的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.