如何下载PowerShell项目引用的Nuget软件包?

发布于 2025-02-08 06:26:57 字数 935 浏览 1 评论 0 原文

我正在创建 .yml ,该自动在github操作中构建.NET框架应用程序。

因此,我尝试通过powershell内部的msbuild.exe构建.NET Framework 4.7.2应用程序。

像这样:

PS : & "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" /t:myProject /p:Configuration=Release

但是,您可以看到以下错误,并且无法下载软件包。

错误:此项目参考Nuget软件包丢失了 这台计算机。使用Nuget软件包还原下载它们。更多 信息,请参阅 http://go.microsoft.com/fosrosoft.com/fwlink/?linkid = 3222105 。这 缺少文件是 ..\packages\MaterialDesignThemes.4.5.0\build\MaterialDesignThemes.targets.

如何通过msbuild.exe下载我需要从powershell构建的软件包?

(由于.NET框架而无法使用Dotnet CLI。)

谢谢!

++ Visual Studio正常建造。我想要的是一个为CI/CD管道自动构建的脚本。

I'm creating .yml that automatically builds .NET Framework applications in GitHub Action.

So, I try to build .NET Framework 4.7.2 Application via Msbuild.exe inside Powershell.

like this:

PS : & "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" /t:myProject /p:Configuration=Release

However, you can see the following errors, and you cannot download the packages.

error : This project references NuGet package(s) that are missing on
this computer. Use NuGet Package Restore to download them. For more
information, see http://go.microsoft.com/fwlink/?LinkID=322105. The
missing file is
..\packages\MaterialDesignThemes.4.5.0\build\MaterialDesignThemes.targets.

How can I download the package that I need to build from Powershell through msbuild.exe?

(The dotnet CLI is not available because of the .NET Framework.)

Thanks!

++
Visual Studio builds normally. What I want is a script that is built automatically for the CI/CD pipeline.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦太阳 2025-02-15 06:26:57

我找到了一个解决方案。
我可以使用Nuget CLI代替Dotnet CLI。

  • Nuget CLI:用于.NET框架库的CLI工具和任何非SDK风格的项目,例如针对.NET标准库的项目。 (

解决方案:

  1. 下载nuget cli
  2. ps:nuget Restore

I found a solution.
I can use the nuget CLI instead of the dotnet CLI.

Solution :

  1. Download the nuget CLI
  2. PS : nuget restore
泅渡 2025-02-15 06:26:57

https:https:// hearn。 microsoft.com/en-us/nuget/consume-packages/package-restore#restore-usis-usis-us-visual-studio 这是所有的方式。

如果没有任何帮助,您可以尝试使用以下方式手动安装软件包:

Install-Package <Package Name>

https://learn.microsoft.com/en-us/nuget/consume-packages/package-restore#restore-using-visual-studio here are all the ways.

If nothing helps you can try installing the packages manually using:

Install-Package <Package Name>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文