Azure Devops - 将版本解析为 .nuspec 文件
如何将 .yaml 文件中的指定版本解析为 .nuspec 文件?
以下是 .yaml 文件
variables:
solution: '**/*.csproj'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
version.MajorMinor: '1.0'
version.Revision: $[counter(variables['version.MajorMinor'], 0)]
versionNumber: '$(version.MajorMinor).$(version.Revision)'
steps:
- task: DotNetCoreCLI@2
displayName: '$(buildConfiguration)'
inputs:
command: 'pack'
packagesToPack: '**/*.nuspec'
versioningScheme: 'byEnvVar'
versionEnvVar: 'versionNumber'
.nuspec 文件
<?xml version="1.0" ?>
<package>
<metadata>
<id>Project</id>
<version>0.0.1</version>
<description>Project description</description>
<authors>Me</authors>
</metadata>
<files>
<file src="bin\**\*.dll" target="lib" />
</files>
</package>
的重要部分我正在使用 .nuspec 文件,以便我可以在 NuGet 包中包含一些其他 .dll。如何使用 DotNetCoreCLI@2
任务将 versionNumber
变量解析为 .nuspec 文件?
How can I parse the specified version from the .yaml file to the .nuspec file?
Here are the important parts of the .yaml file
variables:
solution: '**/*.csproj'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
version.MajorMinor: '1.0'
version.Revision: $[counter(variables['version.MajorMinor'], 0)]
versionNumber: '$(version.MajorMinor).$(version.Revision)'
steps:
- task: DotNetCoreCLI@2
displayName: '$(buildConfiguration)'
inputs:
command: 'pack'
packagesToPack: '**/*.nuspec'
versioningScheme: 'byEnvVar'
versionEnvVar: 'versionNumber'
.nuspec file
<?xml version="1.0" ?>
<package>
<metadata>
<id>Project</id>
<version>0.0.1</version>
<description>Project description</description>
<authors>Me</authors>
</metadata>
<files>
<file src="bin\**\*.dll" target="lib" />
</files>
</package>
I'm using the .nuspec file so that I can include some other .dlls in the NuGet package. How can I parse the versionNumber
variable to the .nuspec file using DotNetCoreCLI@2
task?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
XmlTransformV1@0
任务覆盖管道中的versionNumber
:https://marketplace.visualstudio.com/items?itemName=dzhukovsky.xml-transform
构建定义:
发布定义:
You can use
XmlTransformV1@0
task to overrideversionNumber
in your Pipeline:https://marketplace.visualstudio.com/items?itemName=dzhukovsky.xml-transform
Build defenition:
Release definition: