diff --git a/.github/workflows/codecoverage.yml b/.github/workflows/codecoverage.yml index 736d7475..d0963441 100644 --- a/.github/workflows/codecoverage.yml +++ b/.github/workflows/codecoverage.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v2.3.4 - name: Restore Nuget Packages - run: dotnet restore EstateManagementUI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} + run: dotnet restore EstateManagementUI.sln --configfile NuGet.Config - name: Build Code run: dotnet build EstateManagementUI.sln --configuration Release diff --git a/.github/workflows/createrelease.yml b/.github/workflows/createrelease.yml index 039e7f1a..2d44cfd1 100644 --- a/.github/workflows/createrelease.yml +++ b/.github/workflows/createrelease.yml @@ -20,7 +20,7 @@ jobs: run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - name: Restore Nuget Packages - run: dotnet restore EstateManagementUI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} + run: dotnet restore EstateManagementUI.sln --configfile NuGet.Config - name: Build Code run: dotnet build EstateManagementUI.sln --configuration Release --no-restore @@ -45,7 +45,7 @@ jobs: - name: Publish UI if: ${{ github.event.release.prerelease == false }} - run: dotnet publish "EstateManagementUI.BlazorServer\EstateManagementUI.BlazorServer.csproj" --configuration Release --output publishOutput -r win-x64 --self-contained + run: dotnet publish "EstateManagementUI.BlazorServer\EstateManagementUI.BlazorServer.csproj" --configuration Release --output publishOutput -r win-x64 --self-contained --no-restore -p:Version=${{ steps.get_version.outputs.VERSION }} -p:AssemblyVersion=${{ steps.get_version.outputs.VERSION }} -p:FileVersion=${{ steps.get_version.outputs.VERSION }} @@ -126,4 +126,4 @@ jobs: $servicePath = "C:\txnproc\transactionprocessing\estatemanagementui\EstateManagementUI.BlazorServer.exe" New-Service -Name $serviceName -BinaryPathName $servicePath -Description $serviceName -DisplayName $serviceName -StartupType Automatic - Start-Service -Name $serviceName \ No newline at end of file + Start-Service -Name $serviceName diff --git a/.github/workflows/nightlybuild.yml b/.github/workflows/nightlybuild.yml index 82e2f37e..5e90274d 100644 --- a/.github/workflows/nightlybuild.yml +++ b/.github/workflows/nightlybuild.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v2.3.4 - name: Restore Nuget Packages - run: dotnet restore EstateManagementUI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} + run: dotnet restore EstateManagementUI.sln --configfile NuGet.Config - name: Build Code run: | diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 165dab88..71ccb3dc 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -28,7 +28,7 @@ jobs: dotnet-version: '10.0.x' - name: Restore NuGet packages - run: dotnet restore EstateManagementUI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} + run: dotnet restore EstateManagementUI.sln --configfile NuGet.Config - name: Build solution run: dotnet build EstateManagementUI.sln --configuration Release --no-restore @@ -93,7 +93,7 @@ jobs: run: docker build . --file EstateManagementUI.BlazorServer/Dockerfile --tag estatemanagementuiblazorserver:latest - name: Restore Nuget Packages - run: dotnet restore EstateManagementUI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} + run: dotnet restore EstateManagementUI.sln --configfile NuGet.Config - name: Build Integration Tests run: dotnet build EstateManagementUI.IntegrationTests/EstateManagementUI.IntegrationTests.csproj --configuration Debug --no-restore diff --git a/EstateManagementUI.BlazorServer/Dockerfile b/EstateManagementUI.BlazorServer/Dockerfile index 4b6de0eb..bf72f558 100644 --- a/EstateManagementUI.BlazorServer/Dockerfile +++ b/EstateManagementUI.BlazorServer/Dockerfile @@ -10,11 +10,11 @@ WORKDIR /src RUN curl -fsSL --insecure https://deb.nodesource.com/setup_20.x | bash - && \ apt-get install -y nodejs -COPY ["EstateManagementUI.BlazorServer/NuGet.Config", "."] +COPY ["NuGet.Config", "."] COPY ["EstateManagementUI.BlazorServer/Certificates/*.*", "Certificates/"] COPY ["EstateManagementUI.BlazorServer/EstateManagementUI.BlazorServer.csproj", "EstateManagementUI.BlazorServer/"] COPY ["Directory.Packages.props", "."] -RUN dotnet restore "./EstateManagementUI.BlazorServer/EstateManagementUI.BlazorServer.csproj" +RUN dotnet restore "./EstateManagementUI.BlazorServer/EstateManagementUI.BlazorServer.csproj" --configfile NuGet.Config COPY . . WORKDIR "/src/EstateManagementUI.BlazorServer" diff --git a/EstateManagementUI.BlazorServer/Dockerfile.original b/EstateManagementUI.BlazorServer/Dockerfile.original index 993d3bb2..33f9fc2d 100644 --- a/EstateManagementUI.BlazorServer/Dockerfile.original +++ b/EstateManagementUI.BlazorServer/Dockerfile.original @@ -10,10 +10,10 @@ WORKDIR /src RUN curl -fsSL --insecure https://deb.nodesource.com/setup_20.x | bash - && \ apt-get install -y nodejs -COPY ["EstateManagementUI.BlazorServer/NuGet.Config", "."] +COPY ["NuGet.Config", "."] COPY ["EstateManagementUI.BlazorServer/Certificates/*.*", "Certificates/"] COPY ["EstateManagementUI.BlazorServer/EstateManagementUI.BlazorServer.csproj", "EstateManagementUI.BlazorServer/"] -RUN dotnet restore "./EstateManagementUI.BlazorServer/EstateManagementUI.BlazorServer.csproj" +RUN dotnet restore "./EstateManagementUI.BlazorServer/EstateManagementUI.BlazorServer.csproj" --configfile NuGet.Config COPY . . WORKDIR "/src/EstateManagementUI.BlazorServer" diff --git a/EstateManagementUI.BlazorServer/NuGet.Config b/EstateManagementUI.BlazorServer/NuGet.Config deleted file mode 100644 index 3086e202..00000000 --- a/EstateManagementUI.BlazorServer/NuGet.Config +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 00000000..922d776c --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/superpowers/plans/2026-06-25-nuget-source-mapping.md b/docs/superpowers/plans/2026-06-25-nuget-source-mapping.md new file mode 100644 index 00000000..2b429dc0 --- /dev/null +++ b/docs/superpowers/plans/2026-06-25-nuget-source-mapping.md @@ -0,0 +1,149 @@ +# NuGet Source Mapping Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Make package restore work consistently with central package management by using one root NuGet configuration with package source mapping in local builds, Docker builds, and GitHub Actions workflows. + +**Architecture:** Keep a single `NuGet.Config` at the repository root so every restore path can discover the same package sources, credentials, and source mapping. Update Docker and workflow restore commands to use that file explicitly, then remove the project-local config so there is no competing restore policy. + +**Tech Stack:** .NET SDK restore/publish, NuGet package source mapping, GitHub Actions, Docker + +--- + +### Task 1: Add root NuGet policy + +**Files:** +- Create: `NuGet.Config` +- Delete: `EstateManagementUI.BlazorServer/NuGet.Config` + +- [ ] **Step 1: Add the root NuGet config** + +```xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` + +- [ ] **Step 2: Remove the project-local config** + +Delete `EstateManagementUI.BlazorServer/NuGet.Config` so the root config becomes the only active NuGet policy in the repo. + +- [ ] **Step 3: Verify the root config is discoverable** + +Run: + +```powershell +dotnet restore EstateManagementUI.sln --configfile NuGet.Config +``` + +Expected: restore uses the root config and no longer warns about multiple sources without mapping. + +### Task 2: Point Docker and CI at the root config + +**Files:** +- Modify: `EstateManagementUI.BlazorServer/Dockerfile` +- Modify: `EstateManagementUI.BlazorServer/Dockerfile.original` +- Modify: `.github/workflows/pullrequest.yml` +- Modify: `.github/workflows/codecoverage.yml` +- Modify: `.github/workflows/nightlybuild.yml` +- Modify: `.github/workflows/createrelease.yml` + +- [ ] **Step 1: Make Docker restore use the root config** + +```dockerfile +COPY ["NuGet.Config", "."] +COPY ["EstateManagementUI.BlazorServer/Certificates/*.*", "Certificates/"] +COPY ["EstateManagementUI.BlazorServer/EstateManagementUI.BlazorServer.csproj", "EstateManagementUI.BlazorServer/"] +COPY ["Directory.Packages.props", "."] +RUN dotnet restore "./EstateManagementUI.BlazorServer/EstateManagementUI.BlazorServer.csproj" --configfile NuGet.Config +``` + +- [ ] **Step 2: Make CI restore use the same config** + +Use the repository root config explicitly in every restore step: + +```yaml +run: dotnet restore EstateManagementUI.sln --configfile NuGet.Config +``` + +Remove any `--source ...` arguments from those restore steps so they do not bypass the mapped source policy. + +- [ ] **Step 3: Re-run publish/build commands with no extra restore** + +Keep the existing `--no-restore` build steps, and add `--no-restore` to any `dotnet publish` step that follows a restore in the same job. + +- [ ] **Step 4: Verify in CI syntax and locally** + +Run: + +```powershell +dotnet restore EstateManagementUI.sln --configfile NuGet.Config +dotnet build EstateManagementUI.sln --configuration Release --no-restore +``` + +Expected: restore completes with the mapped config, and build reuses the restored assets.