【问题标题】:VisualStudio Online and pack Nuget packagesVisualStudio Online 和打包 Nuget 包
【发布时间】:2018-06-06 08:15:35
【问题描述】:

当我有一些类库时,我正在Visual Studio OnLine 中创建一个存储库。我想在我的私有存储库中创建(打包)并为每个人推送一个 Nuget 包。

在一个项目中,依赖于Microsoft.ApplicationInsights。如果我在我的计算机上创建一个包,它工作正常。如果我尝试在 Visual Studio Online 上执行相同操作,则会出现错误:

nuget 命令失败,退出代码 (1) 和 错误(NuGet.CommandLine.CommandLineException:找不到 'Microsoft.ApplicationInsights.2.6.4.nupkg'。确保项目有 已建成。

这是完整的错误:

NuGet 版本:4.1.0.2450 尝试从 'Vu.Common.Logging.AppInsightsEvent.csproj'。 MSBuild 自动检测: 使用“C:\Program Files”中的 msbuild 版本“15.6.85.37198” (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'。采用 选项 -MSBuildVersion 强制 nuget 使用特定版本的 微软构建。打包文件来自 'D:\a\1\s\Vu.Common\Vu.Common.Logging.AppInsightsEvent\bin\Release'。 对元数据使用“Vu.Common.Logging.AppInsightsEvent.nuspec”。添加 文件 'D:\a\1\s\Vu.Common\Vu.Common.Logging.AppInsightsEvent\bin\Release\Vu.Common.Logging.AppInsightsEvent.dll' 打包为“lib\net462\Vu.Common.Logging.AppInsightsEvent.dll” 找到 packages.config。使用列为依赖项的包 NuGet.CommandLine.CommandLineException:找不到 'Microsoft.ApplicationInsights.2.6.4.nupkg'。确保项目有 已建成。在 NuGet.CommandLine.ProjectFactory.AddDependencies(字典`2 包和依赖项)在 NuGet.CommandLine.ProjectFactory.ProcessDependencies(PackageBuilder builder) 在 NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath、NuGetVersion 版本、字符串后缀、布尔 buildIfNeeded、 PackageBuilder 构建器)在 NuGet.Commands.PackCommandRunner.BuildFromProjectFile(字符串路径)
在 NuGet.CommandLine.PackCommand.ExecuteCommand() 在 NuGet.CommandLine.Command.ExecuteCommandAsync() 在 NuGet.CommandLine.Command.Execute() 在 NuGet.CommandLine.Program.MainCore(字符串工作目录,字符串 [] 参数)

我的配置很简单。我添加了两个Nuget,第一个是打包我的nuget,第二个是推送到存储库中。

我尝试了不同的配置,还手动创建了nuspec 文件,但没有结果。

有什么想法吗?打包和部署 nugget 包的正确方法是什么?

更新

在构建过程中,我看到的错误是这样的:

然后我尝试在我的本地文件夹上创建相同的包。我只删除了OutputDirectoryNonInteractive 和初始路径。我可以毫无问题地创建包。

【问题讨论】:

  • 运行pack命令前包是否恢复?

标签: c# visual-studio nuget azure-pipelines azure-artifacts


【解决方案1】:

根据错误信息,您的 nuget 包似乎无法从 url 下载引用的 nuget 包。

您可以尝试直接使用 Package: NuGet 扩展名并选择 Pack NuGet packages 并尝试 agian,而不是使用自定义 nuget 命令。

也可以enable Verbose Debug Mode 添加system.debug=true 以获取更多详细日志以进行故障排除并缩小问题范围。

【讨论】:

  • 谢谢。我这样做了,结果是我的问题。 :D
  • @Enrico 错误很明显,您缺少“Serilog.2.7.1.nupkg”的引用,您可以尝试远程构建代理。并在运行命令中键入%appdata% 并选择 nuget --nuget.config 手动在配置文件中添加引用。然后尝试再次构建。它应该可以正常工作。
猜你喜欢
  • 2020-05-23
  • 2015-08-22
  • 1970-01-01
  • 2020-01-11
  • 1970-01-01
  • 1970-01-01
  • 2021-04-18
  • 1970-01-01
  • 2014-09-03
相关资源
最近更新 更多