![](/img/trans.png)
[英]Nuget Automatic Restore - Specifying custom repositories for TFS Build
[英]TFS Automatic Build : Nuget Pack fail with code(1)
我正在尝试在WFS项目的TFS中实现自动构建。 自动构建的效果很好,但是我无法为该项目准备一个nuget包。
这是我在TFS中的构建过程:
如果我删除了NuGet pack和NuGet push,它将正常工作。
这是我通过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”
我已经尝试在NuGet用于打包的命令上添加-Prop Platform=AnyCPU
,但它没有任何改变。 我在计算机上运行了该命令,它可以正常工作。
这是我在查找修复程序时已经检查过的页面:
当您打包并选择.csproj
文件时,您可能缺少配置。
如果已选择$(BuildConfiguration)
作为要打包的配置选项。
您还必须指定BuildConfiguration的值
看看使用**\\*.csproj
和**\\*.nuspec
为简单项目指定.csproj文件(例如
**\\*.csproj
)。 在这种情况下:
- 打包程序会编译.csproj文件进行打包。
- 您必须将配置指定为打包(请参见下文)。
- 您不必检入.nuspec文件。 如果您确实签入,则打包程序将接受其设置并替换令牌,例如$ id $和$ description $。
为更复杂的项目指定.nuspec文件(例如
**\\*.nuspec
),例如,需要在单独的步骤中进行编译和打包的多平台方案。 在这种情况下:
- 打包程序不会编译.csproj文件进行打包。
- 每个项目只有在已签入.nuspec文件的情况下才打包。
- 打包程序不会替换.nuspec文件中的令牌(元素除外,请参阅下面的使用内部版本号对程序包进行版本控制)。 您必须为
<id/>
和
<description/>
。 最常见的方法是对
.nuspec
文件中的值。
终于我能够解决这个问题
我发现的解决方法是将.nuspec文件添加到我的项目中。 我将NuGet pack任务更改为使用nuspec而不是csproj。
在那之后(据我所知),一切都运行良好(除了包图标尚不可见)。 但这是另一个故事!
nuspec的参考在这里https://docs.microsoft.com/en-us/nuget/reference/nuspec
在此处可以找到默认的nuspec https://docs.microsoft.com/zh-cn/nuget/create-packages/creating-a-package
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.