简体   繁体   English

Visual Studio多项目模板还原所有nuget包

[英]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: 问题/我想做什么:

  1. Setup a private nuget feed for visual studio in general. 通常,为Visual Studio设置一个私有的nuget feed。
  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. 我考虑过使用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.CoreNuGet.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.

相关问题 在Visual Studio中更新解决方案级别的nuget软件包 - Updating solution level nuget packages in visual studio 在没有Visual Studio的项目中添加NuGet包 - Adding a NuGet package to a project without Visual Studio 在 PowerShell 脚本中,如何还原包以解决错误:此项目引用此计算机上缺少的 NuGet 包 - In PowerShell script, how can I restore packages to resolve error: This project references NuGet package(s) that are missing on this computer Artifactory通过PowerShell的身份验证还原nuget软件包 - Artifactory restore nuget packages with authentication from powershell 在NuGet PowerShell安装中的Visual Studio项目中移动文件? - Move file(s) in a Visual Studio project in NuGet PowerShell install? 如何使用nuget.exe命令行获取特定Visual Studio解决方案的软件包列表 - How to get list of packages of a particular Visual Studio solution with nuget.exe command line Visual Studio 2015中的Nuget崩溃 - Nuget crash in visual studio 2015 Nuget for Visual Studio中的PowerShell项目 - Nuget for PowerShell Projects in Visual Studio 用于创建Visual Studio项目模板扩展Zip问题的PowerShell脚本 - PowerShell Script to Create Visual Studio Project Template Extension Zip Issue 如何从nuget提示符执行Entity Framework Core项目并在Visual Studio 2015中添加迁移? - How can I do an Entity Framework Core project and add a Migration in Visual Studio 2015 from nuget prompt?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM