-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathget-assembly-native-version.yml
More file actions
31 lines (22 loc) · 959 Bytes
/
get-assembly-native-version.yml
File metadata and controls
31 lines (22 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.
steps:
- task: PowerShell@2
condition: >-
and(
succeeded(),
eq(variables['StartReleaseCandidate'], false),
not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
)
displayName: Get AssemblyNativeVersion version
inputs:
targetType: 'inline'
script: |
$assemblyInfoFiles = (Get-ChildItem -Path ".\*" -Include "AssemblyInfo.cs" -Recurse)
$attributeRegex = [regex]::new('("AssemblyNativeVersion\(")|(\d+\.\d+\.\d+\.\d+)|(""\))')
# read attribute from file
$fileContent = Get-Content($assemblyInfoFiles[0])
$attrib = $attributeRegex.Match($fileContent)
$nativeVersion = $attrib.Groups[2].value
Write-Host "AssemblyNativeVersion is $nativeVersion"
Write-Host "$("##vso[task.setvariable variable=NF_ASSEMBLY_NATIVE_VERSION]")$nativeVersion"