以下是我在管道Nuget Pack任务中看到的内容
我正在尝试做的是使用**/*.nuspec
文件的Nuget Pack。
这个项目可以在本地使用 nuget 包打包而没有问题
由于某种原因,它没有在 csproj 程序集文件中选取属性值
程序集文件中的内容
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("SOMECOMPANY.Mapping")]
[assembly: AssemblyDescription("SOMECOMPANY Mapping")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("SOMECOMPANY")]
[assembly: AssemblyProduct("SOMECOMPANY.Mapping")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("SOMECOMPANY")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("9c3a7a3b-964b-4d85-b543-8bcc55fc6589")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
管线中有什么
##[section]Starting: NuGet pack
==============================================================================
Task : NuGet
Description : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Azure Artifacts and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.
Version : 2.156.0
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/package/nuget
==============================================================================
[command]C:windowssystem32chcp.com 65001
Active code page: 65001
##[warning]The automatic package versioning and include referenced projects options do not work together. Referenced projects will not inherit the custom version provided by the automatic versioning settings.
Attempting to pack file: d:a1ssrcSOMECOMPANY.CoreSOMECOMPANY.MappingSOMECOMPANY.Mapping.nuspec
[command]C:hostedtoolcachewindowsNuGet4.1.0x64nuget.exe pack d:a1ssrcSOMECOMPANY.CoreSOMECOMPANY.MappingSOMECOMPANY.Mapping.nuspec -NonInteractive -OutputDirectory d:a1a -IncludeReferencedProjects -Symbols -version 1.0.0-CI-20190824-170629 -Verbosity Detailed
System.Exception: Id is required.
NuGet Version: 4.1.0.2450
**Authors is required.
Attempting to build package from 'SOMECOMPANY.Mapping.nuspec'.
Description is required.**
at NuGet.Packaging.Manifest.Validate(Manifest manifest)
at NuGet.Packaging.Manifest.ReadFrom(Stream stream, Func`2 propertyProvider, Boolean validateSchema)
at NuGet.Packaging.PackageBuilder.ReadManifest(Stream stream, String basePath, Func`2 propertyProvider)
at NuGet.Packaging.PackageBuilder..ctor(String path, String basePath, Func`2 propertyProvider, Boolean includeEmptyDirectories)
at NuGet.Commands.PackCommandRunner.CreatePackageBuilderFromNuspec(String path)
at NuGet.Commands.PackCommandRunner.BuildFromNuspec(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)
**##[error]The nuget command failed with exit code(1) and error(System.Exception:** **Id is required.
Authors is required.
Description is required.**
at NuGet.Packaging.Manifest.Validate(Manifest manifest)
at NuGet.Packaging.Manifest.ReadFrom(Stream stream, Func`2 propertyProvider, Boolean validateSchema)
at NuGet.Packaging.PackageBuilder.ReadManifest(Stream stream, String basePath, Func`2 propertyProvider)
at NuGet.Packaging.PackageBuilder..ctor(String path, String basePath, Func`2 propertyProvider, Boolean includeEmptyDirectories)
at NuGet.Commands.PackCommandRunner.CreatePackageBuilderFromNuspec(String path)
at NuGet.Commands.PackCommandRunner.BuildFromNuspec(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))
##[error]An error occurred while trying to pack the files.
##[section]Finishing: NuGet pack
解决了。使用 Nuspec 打包时,不会选取程序集值。 只有在使用CSProj文件上的包时,它才会被拾取。
我所做的是指定包中的所有 csproj 文件
MSdn https://learn.microsoft.com/en-us/nuget/reference/nuspec