我在Azure DevOps中有一个名为MyProject
的项目和存储库。在此的构建管道中,我尝试打包并推送NuGet,但我希望名称更改为MyCompany.MyProject
。
我已将Id
(和Description
)添加到azure-pipelines.yml命令的属性中,如下所示:
- task: NuGetCommand@2
displayName: 'NuGet pack'
inputs:
command: pack
packagesToPack: '**/*.csproj'
versioningScheme: byEnvVar
versionEnvVar: nugetVersion
buildProperties: 'Id=MyCompany.MyProject;Description=Test'
尽管这些内容包含在-Properties
到nuget pack
命令中(请参见下文),但它们不会被使用。我的NuGet名称仅保留MyProject
,并在NuGetCommand@2
任务的以下输出中指出,它说WARNING: NU5115: Description was not specified
。
[command]C:\hostedtoolcache\windows\NuGet\5.2.0\x64\nuget.exe pack d:\a\1\s\MyProject\MyProject.csproj -NonInteractive -OutputDirectory d:\a\1\a -Properties Configuration=Release;Id=MyCompany.MyProject;Description=Test -version 1.1.9 -Verbosity Detailed
NuGet Version: 5.2.0.6090
Attempting to build package from 'MyProject.csproj'.
MSBuild auto-detection: using msbuild version '16.200.19.32702' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Packing files from 'd:\a\1\s\MyProject\bin\Release\netcoreapp2.1'.
Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Add file 'd:\a\1\s\MyProject\bin\Release\netcoreapp2.1\MyProject.dll' to package as 'lib\netcoreapp2.1\MyProject.dll'
WARNING: NU5115: Description was not specified. Using 'Description'.
该命令似乎为这些属性使用了其他来源。我可以更改吗?
有些帖子似乎说使用* .csproj。我尝试将VS2017中项目Properties>Package
中的字段设置为所需的值,但这没有帮助。
编辑:
我没有AssemblyInfo.cs
或.nuspec
,并且不想添加。因此,我不同意这是duplicate。 zivkan建议使用dotnet pack
而不是nuget pack
导致了一个解决方案,而不必添加任何一个。