VisualStudio Online并打包Nuget包 [英] VisualStudio Online and pack Nuget packages

查看:127
本文介绍了VisualStudio Online并打包Nuget包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我有一些类库时,我正在 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使用
MSBuild的特定版本。
'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
生成器)在NuGet.CommandLine.ProjectFactory.CreateBuilder (NuGet处的字符串(
basePath,NuGetVersion版本,字符串后缀,布尔值buildIfNeeded,
PackageBuilder构建器))在
处NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)

。在
处的CommandLine.PackCommand.ExecuteCommand()在
处的NuGet.CommandLine.Command.ExecuteCommandAsync()在
处的NuGet.CommandLine.Command.Execute()在
处NuGet.CommandLine.Program.MainCore(String workingDirectory ,String []
args)


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



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



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





更新



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





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



解决方案

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



您不是使用customize nuget命令,而是可以尝试使用



启用详细调试模式以获取通过添加 system.debug = true 记录更多详细信息,以进行故障排除并缩小问题范围。


I'm creating a repository in Visual Studio OnLine when I have some class libraries. I want to create (pack) and push for each of them a Nuget package in my private repository.

In a project there is a dependency on Microsoft.ApplicationInsights. If I create on my computer a package, it is working fine. If I try to do the same on Visual Studio Online I have an error:

The nuget command failed with exit code(1) and error(NuGet.CommandLine.CommandLineException: Unable to find 'Microsoft.ApplicationInsights.2.6.4.nupkg'. Make sure the project has been built.

This is the full error:

NuGet Version: 4.1.0.2450 Attempting to build package from 'Vu.Common.Logging.AppInsightsEvent.csproj'. MSBuild auto-detection: using msbuild version '15.6.85.37198' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild. Packing files from 'D:\a\1\s\Vu.Common\Vu.Common.Logging.AppInsightsEvent\bin\Release'. Using 'Vu.Common.Logging.AppInsightsEvent.nuspec' for metadata. Add file 'D:\a\1\s\Vu.Common\Vu.Common.Logging.AppInsightsEvent\bin\Release\Vu.Common.Logging.AppInsightsEvent.dll' to package as 'lib\net462\Vu.Common.Logging.AppInsightsEvent.dll' Found packages.config. Using packages listed as dependencies NuGet.CommandLine.CommandLineException: Unable to find 'Microsoft.ApplicationInsights.2.6.4.nupkg'. Make sure the project has been built. at NuGet.CommandLine.ProjectFactory.AddDependencies(Dictionary`2 packagesAndDependencies) at NuGet.CommandLine.ProjectFactory.ProcessDependencies(PackageBuilder builder) at NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded, PackageBuilder builder) at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)
at NuGet.CommandLine.PackCommand.ExecuteCommand() at NuGet.CommandLine.Command.ExecuteCommandAsync() at NuGet.CommandLine.Command.Execute() at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)

My configuration is easy. I added two Nuget, the first it is packing my nuget and the second push in the repository it.

I tried different configuration and also created manually the nuspec file but without result.

Any ideas? What is the right way to pack and deploy nugget packages?

Update

During the build the error I saw is like that:

Then I tried to create the same package on my local folder. I've only removed OutputDirectory, NonInteractive and the initial path. I can create the package without problem.

解决方案

According to the error message, seems your nuget packages failed to download the referenced nuget packages from url.

Instead of using customize nuget command, you could try to use Package: NuGet extension directly and select Pack NuGet packages and try agian.

Also enable Verbose Debug Mode to get more detail log by add system.debug=true for troubleshooting and narrow down the issue.

这篇关于VisualStudio Online并打包Nuget包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆