File tree Expand file tree Collapse file tree
src/NLog.Extensions.Logging Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ build_script:
44- ps : >-
55 dotnet restore src\NLog.Extensions.Logging
66
7+ .\patchFileVersion.ps1 "NLog.Extensions.Logging.csproj" "$env:appveyor_build_version"
8+
79 dotnet pack src\NLog.Extensions.Logging --configuration Release
810artifacts :
911- path : ' src\NLog.Extensions.Logging\bin\release\*.nupkg'
Original file line number Diff line number Diff line change 1+ param ([string ]$filewildCard , [string ]$version )
2+
3+ # returns FileInfo
4+ function findFile ([string ]$filewildCard ) {
5+
6+ $files = @ (Get-ChildItem $filewildCard - Recurse);
7+ if ($files.Length -gt 1 ) {
8+ throw " Found $ ( $files.length ) files. Stop, we need an unique pattern"
9+ }
10+ if ($files.Length -eq 0 ) {
11+ throw " Find not found with pattern $filewildCard . Stop"
12+ }
13+ return $files [0 ];
14+ }
15+
16+ function patchAssemblyFileVersion ([System.IO.FileInfo ]$file , [string ]$version ) {
17+
18+ $xmlPath = $file.FullName ;
19+
20+ $xml = [xml ](get-content $xmlPath )
21+
22+ $propertyGroup = $xml.Project.PropertyGroup
23+
24+ Write-Host " patch $xmlPath to $version "
25+
26+ # FileVersion = AssemblyFileVersionAttribute
27+ $propertyGroup [0 ].FileVersion = $version
28+
29+ $xml.Save ($xmlPath )
30+ }
31+
32+ $file = findFile $filewildCard - ErrorAction Stop
33+
34+ patchAssemblyFileVersion $file $version - ErrorAction Stop
35+
36+
37+
38+ trap
39+ {
40+ write-output $_
41+ exit 1
42+ }
Original file line number Diff line number Diff line change @@ -28,6 +28,11 @@ rc2 (see https://github.com/NLog/NLog.Extensions.Logging/milestone/9?closed=1)
2828 <RepositoryType >git</RepositoryType >
2929 <RepositoryUrl >git://github.com/NLog/NLog.Extensions.Logging</RepositoryUrl >
3030 <Version >1.0.0-rtm-rc2</Version >
31+
32+ <AssemblyVersion >1.0.0.0</AssemblyVersion >
33+ <!-- AssemblyVersion: keep 1.0.0.0-->
34+ <FileVersion >1.0.0.0</FileVersion >
35+ <!-- FileVersion = AssemblyFileVersionAttribute, patched by AppVeyor -->
3136 </PropertyGroup >
3237
3338 <ItemGroup Condition =" '$(TargetFramework)' == 'net451' " >
You can’t perform that action at this time.
0 commit comments