Skip to content

Commit e9e4ebe

Browse files
committed
Work CI-CD
- Need to remove package before updating otherwise we get duplicated references. - Fix PS1 replacing package version throughout the various files. - Add PS1 to force adding GeneratePathProperty after update. - Add helpers for local debug. ***-«NO_CI***
1 parent cdb39c1 commit e9e4ebe

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

azure-pipelines/update-dependents.ps1

+25-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,33 @@ function UpdateTestFrameworkVersion {
1010
$filecontent = Get-Content($FilePath)
1111
attrib $FilePath -r
1212
$filecontent -replace $versionRegex1, "nanoFramework.TestFramework.$NewVersion" | Out-File $FilePath -Encoding utf8
13+
$filecontent = Get-Content($FilePath)
1314
$filecontent -replace $versionRegex2, "id=""nanoFramework.TestFramework"" version=""$NewVersion" | Out-File $FilePath -Encoding utf8
1415
}
1516

17+
function AddGeneratePathProperty {
18+
Param(
19+
[string] $NewVersion,
20+
[string] $FilePath
21+
)
22+
23+
$versionRegex1 = "Include=\""nanoFramework\.TestFramework\"" Version=\""\d+\.\d+\.\d+\"">"
24+
25+
$filecontent = Get-Content($FilePath)
26+
attrib $FilePath -r
27+
$filecontent -replace $versionRegex1, "Include=""nanoFramework.TestFramework"" Version=""$NewVersion"" GeneratePathProperty=""true"">" | Out-File $FilePath -Encoding utf8
28+
}
29+
1630
"Updating dependency at nf-Visual-Studio-extension" | Write-Host
1731

1832
# compute authorization header in format "AUTHORIZATION: basic 'encoded token'"
1933
# 'encoded token' is the Base64 of the string "nfbot:personal-token"
2034
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$env:MY_GITHUB_TOKEN"))))"
2135

36+
# uncomment these for local debug
37+
# [Environment]::SetEnvironmentVariable('NBGV_NuGetPackageVersion', '2.0.42', 'Process')
38+
# [Environment]::SetEnvironmentVariable('Agent_TempDirectory', 'e:\temp', 'Process')
39+
2240
# init/reset these
2341
$commitMessage = ""
2442
$prTitle = ""
@@ -50,8 +68,13 @@ dotnet nuget add source https://pkgs.dev.azure.com/nanoframework/feed/_packaging
5068
"*****************************************************************************************************" | Write-Host
5169
"Updating nanoFramework.Tools.MetadataProcessor.MsBuildTask.Net package in VS2019 & VS2022 solution..." | Write-Host
5270

53-
dotnet add VisualStudio.Extension-2019/VisualStudio.Extension-vs2019.csproj package nanoFramework.TestFramework
54-
dotnet add VisualStudio.Extension-2022/VisualStudio.Extension-vs2022.csproj package nanoFramework.TestFramework
71+
dotnet remove VisualStudio.Extension-2019/VisualStudio.Extension-vs2019.csproj package nanoFramework.TestFramework
72+
dotnet add VisualStudio.Extension-2019/VisualStudio.Extension-vs2019.csproj package nanoFramework.TestFramework --version $packageTargetVersion
73+
AddGeneratePathProperty -NewVersion $packageTargetVersion -FilePath 'VisualStudio.Extension-2019/VisualStudio.Extension-vs2019.csproj'
74+
75+
dotnet remove VisualStudio.Extension-2022/VisualStudio.Extension-vs2022.csproj package nanoFramework.TestFramework
76+
dotnet add VisualStudio.Extension-2022/VisualStudio.Extension-vs2022.csproj package nanoFramework.TestFramework --version $packageTargetVersion
77+
AddGeneratePathProperty -NewVersion $packageTargetVersion -FilePath 'VisualStudio.Extension-2022/VisualStudio.Extension-vs2022.csproj'
5578

5679
#####################
5780

0 commit comments

Comments
 (0)