Skip to content

Commit dcf5a35

Browse files
committed
fix: use WebPublishMethod=Package to create per-project PackageTmp dirs
The previous approach used publishUrl=C:\build\_shared at solution level, but MSBuild resolves publishUrl relative to each project directory rather than creating a shared output. Using Package method creates the expected obj/Live/Package/PackageTmp directories under each web project, which we then copy to separate build output directories.
1 parent 44dc503 commit dcf5a35

1 file changed

Lines changed: 10 additions & 31 deletions

File tree

  • cloudformation/scenarios/localgov-ims/docker

cloudformation/scenarios/localgov-ims/docker/Dockerfile

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,38 +26,17 @@ RUN Invoke-WebRequest -Uri 'https://github.com/LocalGovIMS/localgov-ims/archive/
2626
# Restore NuGet packages (all from nuget.org — no GitHub Packages needed)
2727
RUN nuget restore src\LocalGovIms.sln
2828

29-
# Build and publish: solution build compiles with Live config (maps to Release for libs).
30-
# DeployOnBuild publishes each web project. We publish three times with different publishUrl
31-
# to get separate output directories. Each publish overwrites _shared but we copy immediately.
29+
# Build and package: solution build with DeployOnBuild creates PackageTmp directories
30+
# under each web project's obj/Live/Package/PackageTmp with the correct published output.
31+
# We then copy from those per-project directories to separate build output dirs.
3232
RUN msbuild src\LocalGovIms.sln /p:Configuration=Live /p:DeployOnBuild=true `
33-
/p:WebPublishMethod=FileSystem /p:publishUrl=C:\build\_shared /verbosity:minimal ; `
34-
Copy-Item -Path C:\build\_shared -Destination C:\build\portal -Recurse -Force ; `
35-
Write-Host "Portal snapshot taken"
36-
37-
# The solution publish puts all web projects into _shared (last one wins). We need to
38-
# identify each project's output. Since all three share the same _shared dir, we use
39-
# the WAP (Web Application Project) _PackageTempDir which is created during publish.
40-
# Actually, let's just use the obj/Live/Package/PackageTmp directories that MSBuild creates.
41-
RUN if (Test-Path 'src\PaymentPortal\obj\Live\Package\PackageTmp') { `
42-
Copy-Item -Path 'src\PaymentPortal\obj\Live\Package\PackageTmp\*' -Destination C:\build\portal -Recurse -Force ; `
43-
Write-Host "Portal from PackageTmp" `
44-
} ; `
45-
if (Test-Path 'src\Admin\obj\Live\Package\PackageTmp') { `
46-
Copy-Item -Path 'src\Admin\obj\Live\Package\PackageTmp\*' -Destination C:\build\admin -Recurse -Force ; `
47-
Write-Host "Admin from PackageTmp" `
48-
} else { `
49-
New-Item -ItemType Directory -Force C:\build\admin | Out-Null ; `
50-
Copy-Item -Path C:\build\_shared\* -Destination C:\build\admin -Recurse -Force ; `
51-
Write-Host "Admin from _shared fallback" `
52-
} ; `
53-
if (Test-Path 'src\Api\obj\Live\Package\PackageTmp') { `
54-
Copy-Item -Path 'src\Api\obj\Live\Package\PackageTmp\*' -Destination C:\build\api -Recurse -Force ; `
55-
Write-Host "Api from PackageTmp" `
56-
} else { `
57-
New-Item -ItemType Directory -Force C:\build\api | Out-Null ; `
58-
Copy-Item -Path C:\build\_shared\* -Destination C:\build\api -Recurse -Force ; `
59-
Write-Host "Api from _shared fallback" `
60-
}
33+
/p:WebPublishMethod=Package /verbosity:minimal
34+
35+
# Copy each web project's PackageTmp output to separate directories for the runtime stage.
36+
RUN New-Item -ItemType Directory -Force -Path C:\build\portal, C:\build\admin, C:\build\api | Out-Null ; `
37+
Copy-Item -Path 'src\PaymentPortal\obj\Live\Package\PackageTmp\*' -Destination C:\build\portal -Recurse -Force ; `
38+
Copy-Item -Path 'src\Admin\obj\Live\Package\PackageTmp\*' -Destination C:\build\admin -Recurse -Force ; `
39+
Copy-Item -Path 'src\Api\obj\Live\Package\PackageTmp\*' -Destination C:\build\api -Recurse -Force
6140

6241
RUN Write-Host "Portal: $((Get-ChildItem C:\build\portal -Recurse -File).Count) files" ; `
6342
Write-Host "Admin: $((Get-ChildItem C:\build\admin -Recurse -File).Count) files" ; `

0 commit comments

Comments
 (0)