@@ -31,19 +31,6 @@ Describe 'Publish' {
3131 Write-Host " ::group::Create test project"
3232 dotnet new console -- aot -- name hello- sentry -- output . | Write-Host
3333 dotnet add package Sentry -- prerelease -- source $localPackages | Write-Host
34-
35- # Pin the ContainerBaseImage on linux-musl... otherwise the .NET 10 preview7 can't find it
36- $projPath = Join-Path (Get-Location ) ' hello-sentry.csproj'
37- [xml ]$proj = Get-Content $projPath
38- $pg = $proj.CreateElement (' PropertyGroup' )
39- $pg.SetAttribute (' Condition' , ' $([System.String]::new('' $(RuntimeIdentifier)'' ).StartsWith('' linux-musl'' ))' )
40- $cbi = $proj.CreateElement (' ContainerBaseImage' )
41- $cbi.InnerText = ' mcr.microsoft.com/dotnet/nightly/runtime-deps:10.0-preview-alpine3.22'
42- $pg.AppendChild ($cbi ) | Out-Null
43- $proj.Project.AppendChild ($pg ) | Out-Null
44- $proj.Save ($projPath )
45-
46- # Minimal Program.cs
4734 @"
4835SentrySdk.Init(options =>
4936{
@@ -64,21 +51,21 @@ Console.WriteLine("Hello, Sentry!");
6451
6552 It ' Aot' {
6653 $rid = $env: RuntimeIdentifier
67- if ($rid )
68- {
54+ $baseImage = $env: ContainerBaseImage
55+ $publishArgs = @ (' -c' , ' Release' )
56+ if ($rid ) {
6957 Write-Host " Environment RuntimeIdentifier: $rid "
70- dotnet publish - c Release - r $rid | Write-Host
58+ $publishArgs += @ ( ' -r ' , $rid )
7159 }
72- else
73- {
74- Write-Host " Implicit RuntimeIdentifier"
75- dotnet publish - c Release | Write-Host
60+ if ($baseImage ) {
61+ Write-Host " Using ContainerBaseImage: $baseImage "
62+ $publishArgs += " -p:ContainerBaseImage=$baseImage "
7663 }
64+ dotnet publish @publishArgs | Write-Host
7765 $LASTEXITCODE | Should - Be 0
7866
7967 $tfm = (Get-ChildItem - Path " bin/Release" - Directory | Select-Object - First 1 ).Name
80- if (-not $rid )
81- {
68+ if (-not $rid ) {
8269 $rid = (Get-ChildItem - Path " bin/Release/$tfm " - Directory | Select-Object - First 1 ).Name
8370 }
8471 & " bin/Release/$tfm /$rid /publish/hello-sentry" | Write-Host
0 commit comments