如何向使用 DotNetCoreCLI 打包的 Nuget 添加包描述
How to add package description to Nuget packed with DotNetCoreCLI
我有以下 Azure DevOps 任务,它在推送到工件之前创建了一个 nuget pack
。
- task: DotNetCoreCLI@2
displayName: 'Pack'
inputs:
command: 'pack'
nobuild: false
packDirectory: '$(Build.ArtifactStagingDirectory)/$(directory)'
如何为 nuget 包添加包描述?
您可以将buildProperties: '$description$=mydescription'
添加到任务中:
- task: DotNetCoreCLI@2
displayName: 'Pack'
inputs:
command: 'pack'
nobuild: false
packDirectory: '$(Build.ArtifactStagingDirectory)/$(directory)'
buildProperties: 'description=test'
Specifies a list of token = value
pairs, separated by semicolons,
where each occurrence of $token$ in the .nuspec file will be replaced
with the given value. Values can be strings in quotation marks
您也可以使用 nuspec 文件:
这是 csproj 文件:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<NuspecFile>package.nuspec</NuspecFile>
</PropertyGroup>
</Project>
这是 nuspec 文件
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- Required elements-->
<id>UniqeName</id>
<version>1.1.2</version>
<description>UniqueName</description>
<authors>Krzysztof Madej</authors>
<!-- Optional elements -->
<!-- ... -->
</metadata>
<files>
<file src="bin\Release\netstandard2.0\*" target="lib" />
</files>
</package>
这是一个构建
- task: DotNetCoreCLI@2
displayName: "dotnet pack"
inputs:
command: 'pack'
arguments: --configuration $(buildConfiguration) -p:PackageID=my_id -p:PackageVersion=2.1.0
packagesToPack: '$(System.DefaultWorkingDirectory)/Whosebug/08-nuget-packager/SampleApp.csproj'
versioningScheme: 'off'
outputDir: '$(Build.ArtifactStagingDirectory)'
我有以下 Azure DevOps 任务,它在推送到工件之前创建了一个 nuget pack
。
- task: DotNetCoreCLI@2
displayName: 'Pack'
inputs:
command: 'pack'
nobuild: false
packDirectory: '$(Build.ArtifactStagingDirectory)/$(directory)'
如何为 nuget 包添加包描述?
您可以将buildProperties: '$description$=mydescription'
添加到任务中:
- task: DotNetCoreCLI@2
displayName: 'Pack'
inputs:
command: 'pack'
nobuild: false
packDirectory: '$(Build.ArtifactStagingDirectory)/$(directory)'
buildProperties: 'description=test'
Specifies a list of
token = value
pairs, separated by semicolons, where each occurrence of $token$ in the .nuspec file will be replaced with the given value. Values can be strings in quotation marks
您也可以使用 nuspec 文件:
这是 csproj 文件:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<NuspecFile>package.nuspec</NuspecFile>
</PropertyGroup>
</Project>
这是 nuspec 文件
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- Required elements-->
<id>UniqeName</id>
<version>1.1.2</version>
<description>UniqueName</description>
<authors>Krzysztof Madej</authors>
<!-- Optional elements -->
<!-- ... -->
</metadata>
<files>
<file src="bin\Release\netstandard2.0\*" target="lib" />
</files>
</package>
这是一个构建
- task: DotNetCoreCLI@2
displayName: "dotnet pack"
inputs:
command: 'pack'
arguments: --configuration $(buildConfiguration) -p:PackageID=my_id -p:PackageVersion=2.1.0
packagesToPack: '$(System.DefaultWorkingDirectory)/Whosebug/08-nuget-packager/SampleApp.csproj'
versioningScheme: 'off'
outputDir: '$(Build.ArtifactStagingDirectory)'