VisualStudio Online并打包Nuget包

时间:2018-06-06 08:15:36

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

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

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

  

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

这是完整的错误:

  

NuGet版本:4.1.0.2450尝试从中构建包   ' Vu.Common.Logging.AppInsightsEvent.csproj&#39 ;. MSBuild自动检测:   使用msbuild版本' 15.6.85.37198'来自' C:\ Program Files   (x86)\ Microsoft Visual Studio \ 2017 \ Enterprise \ MSBuild \ 15.0 \ bin'。使用   选项-MSBuildVersion强制nuget使用特定版本的   MSBuild的。包装文件来自   ' d:\一个\ 1 \ S \ Vu.Common \ Vu.Common.Logging.AppInsightsEvent \ BIN \推出&#39 ;.   使用' Vu.Common.Logging.AppInsightsEvent.nuspec'用于元数据。加   文件   ' d:\一个\ 1 \ S \ Vu.Common \ Vu.Common.Logging.AppInsightsEvent \ BIN \发布\ Vu.Common.Logging.AppInsightsEvent.dll'   打包为' lib \ net462 \ Vu.Common.Logging.AppInsightsEvent.dll'   找到packages.config。使用列为依赖项的包   NuGet.CommandLine.CommandLineException:无法找到   ' Microsoft.ApplicationInsights.2.6.4.nupkg&#39 ;.确保项目有   已建成。在   NuGet.CommandLine.ProjectFactory.AddDependencies(Dictionary`2   packagesAndDependencies)   NuGet.CommandLine.ProjectFactory.ProcessDependencies(PackageBuilder   在NuGet.CommandLine.ProjectFactory.CreateBuilder(String。)   basePath,NuGetVersion version,String suffix,Boolean buildIfNeeded,   PackageBuilder构建器)   NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)
  在NuGet.CommandLine.PackCommand.ExecuteCommand()中   NuGet.CommandLine.Command.ExecuteCommandAsync()at   NuGet.CommandLine.Command.Execute()at   NuGet.CommandLine.Program.MainCore(String workingDirectory,String []   参数)

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

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

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

Visual Studio OnLine

更新

在构建期间,我看到的错误是这样的:

Error on VSTS Build

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

Local

1 个答案:

答案 0 :(得分:0)

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

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

enter image description here

另外enable Verbose Debug Mode可以通过添加system.debug=true来获取更多详细信息,以便进行问题排查并缩小问题范围。