TFS自动构建:Nuget Pack失败,代码为(1) [英] TFS Automatic Build : Nuget Pack fail with code(1)
问题描述
我正在尝试在WFS项目的TFS中实现自动构建. 自动构建的效果很好,但是我无法在该项目中准备一个nuget程序包.
I'm trying to implement automatic builds in TFS for a WPF project. The automatic build works great, but I can't prepare a nuget package with the project.
这是我在TFS中的构建过程:
Here is my build process in TFS :
如果我删除NuGet pack和NuGet push,它将正常工作.
If I remove NuGet pack and NuGet push, it works without trouble.
这是我通过TFS收到的消息:
Here is the messages I get by TFS:
Found packages.config. Using packages listed as dependencies
NuGet.CommandLine.CommandLineException: Unable to find 'Extended.Wpf.Toolkit.3.3.0.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)
Unable to find 'Extended.Wpf.Toolkit.3.3.0.nupkg'. Make sure the project has been built.
##[error]The nuget command failed with exit code(1) and error(Unable to find 'Extended.Wpf.Toolkit.3.3.0.nupkg'. Make sure the project has been built.)
在日志中,它说没有找到"Extended.Wpf.Toolkit.3.3.0.nupkg".我在构建之前确实使用了NuGet Restore,并且构建是正确的.在TFS的日志中,我可以看到它使用了'Extended.Wpf.Toolkit.3.3.0'
In the logs, it says it doesn't find 'Extended.Wpf.Toolkit.3.3.0.nupkg'. I do use NuGet Restore before my build, and the build is correct. In the logs of TFS, I can see it uses 'Extended.Wpf.Toolkit.3.3.0'
我已经尝试在NuGet用于打包的命令上添加-Prop Platform=AnyCPU
,但是它没有任何改变.我在计算机上运行了命令,它就起作用了.
I already tried to add -Prop Platform=AnyCPU
on the commands used by NuGet for packing but it didn't change anything. I ran the command on my computer and it worked.
以下是我在查找修复程序时已经检查过的页面:
Here are the pages I already checked in my search of a fix :
- https://developercommunity.visualstudio.com/content/problem/245349/the-nuget-command-failed-with-exit-code1-and-error.html
- 用于TFS持续集成的NuGet包
- NuGet包失败,并显示无法找到'@ (_OutputPathItem->'%(FullPath)...'''
- VisualStudio Online并打包Nuget包
- http://timjames.me/blog/2015/07/29/nuget-pack-fails-with-exited-with-code-1/
- https://www.benday.com/2017/05/03/walkthrough-publish-to-private-nuget-server-from-tfs2017-build/
- https://developercommunity.visualstudio.com/content/problem/245349/the-nuget-command-failed-with-exit-code1-and-error.html
- NuGet pack for TFS Continuous Integration
- NuGet pack fails with "Unable to find '@(_OutputPathItem->'%(FullPath)..."
- VisualStudio Online and pack Nuget packages
- http://timjames.me/blog/2015/07/29/nuget-pack-fails-with-exited-with-code-1/
- https://www.benday.com/2017/05/03/walkthrough-publish-to-private-nuget-server-from-tfs2017-build/
推荐答案
在执行打包并选择.csproj
文件时,您可能缺少配置.
You may lack the configuration when you do the pack and select .csproj
file.
如果您已选择$(BuildConfiguration)
作为要打包的配置选项.
If you have selected the $(BuildConfiguration)
as your Configuration to package option.
您还必须指定BuildConfiguration的值
You have to also specify the value of BuildConfiguration
看看使用**\*.csproj
和**\*.nuspec
为简单起见,指定.csproj文件(例如,
**\*.csproj
) 项目.在这种情况下:
Specify .csproj files (for example,
**\*.csproj
) for simple projects. In this case:
- 打包程序会编译.csproj文件进行打包.
- 您必须指定要打包的配置(见下文).
- 您不必检入.nuspec文件.如果您确实签入,则打包程序将接受其设置并替换令牌,例如$ id $和 $ description $.
- The packager compiles the .csproj files for packaging.
- You must specify Configuration to Package (see below).
- You do not have to check in a .nuspec file. If you do check one in, the packager honors its settings and replaces tokens such as $id$ and $description$.
指定.nuspec文件(例如,**\*.nuspec
)以更复杂
项目,例如您需要在其中进行的多平台方案
在单独的步骤中进行编译和打包.在这种情况下:
Specify .nuspec files (for example, **\*.nuspec
) for more complex
projects, such as multi-platform scenarios in which you need to
compile and package in separate steps. In this case:
- 打包程序不会编译.csproj文件进行打包.
- 每个项目只有在已签入.nuspec文件的情况下才打包.
- 打包程序不会替换.nuspec文件中的令牌(该元素除外,请参阅使用内部版本号对程序包进行版本控制,
以下).您必须为
<id/>
和
之类的元素提供值<description/>
.最常见的方法是对
进行硬编码.nuspec
文件中的值.
- The packager does not compile the .csproj files for packaging.
- Each project is packaged only if it has a .nuspec file checked in.
- The packager does not replace tokens in the .nuspec file (except the element, see Use build number to version package,
below). You must supply values for elements such as
<id/>
and
<description/>
. The most common way to do this is to hardcode the
values in the.nuspec
file.
这篇关于TFS自动构建:Nuget Pack失败,代码为(1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!