以下是我在Pipeline Nuget Pack任务中看到的内容
我想做的是使用**/*.nuspec
文件的Nuget Pack。
可以在本地使用nuget pack打包此项目,而不会出现问题
由于某种原因,它没有在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://docs.microsoft.com/azure/devops/pipelines/tasks/package/nuget
==============================================================================
[command]C:\windows\system32\chcp.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:\a\1\s\src\SOMECOMPANY.Core\SOMECOMPANY.Mapping\SOMECOMPANY.Mapping.nuspec
[command]C:\hostedtoolcache\windows\NuGet\4.1.0\x64\nuget.exe pack d:\a\1\s\src\SOMECOMPANY.Core\SOMECOMPANY.Mapping\SOMECOMPANY.Mapping.nuspec -NonInteractive -OutputDirectory d:\a\1\a -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
答案 0 :(得分:1)
解决了。使用nuspec打包时,汇编值不会被提取。仅在csproj文件上使用pack时才会拾取。
我所做的是在包中指定所有csproj文件
MSdn https://docs.microsoft.com/en-us/nuget/reference/nuspec