Skip to content

(maint) Support both packages.config and csproj#1128

Merged
vexx32 merged 2 commits into
chocolatey:developfrom
AdmiringWorm:support-packages-config-and-csproj
May 22, 2026
Merged

(maint) Support both packages.config and csproj#1128
vexx32 merged 2 commits into
chocolatey:developfrom
AdmiringWorm:support-packages-config-and-csproj

Conversation

@AdmiringWorm

@AdmiringWorm AdmiringWorm commented Apr 15, 2026

Copy link
Copy Markdown
Member

Description Of Changes

  • Add conditional logic to detect and parse either packages.config or .csproj files for chocolatey.lib version
  • Store detection result in isNewCsproj flag for downstream path logic
  • Update chocolateyLibPackageFolder path construction based on project format
  • Change build.debug.bat target from Restore to Init
  • Add fallback logic for code_drop library path with net48 subdirectory support
  • Throw descriptive error if neither package format is found

Motivation and Context

Support modern SDK-style csproj projects alongside legacy packages.config format. Ensure script works with both old and new project structures and improve build initialization process.

Testing

  1. Run .\Get-ChocoUpdatedDebugVersion.ps1 -CheckoutRefTag
  2. Wait for the build no finish.
  3. Open the solution script, and debug the application (may need to run Rebuild first).
  4. Verify the file Source/packages/chocolatey.lib/2.7.0/lib/net48/chocolatey.dll have the last changed date of today.

Operating Systems Testing

  • Windows 11

Change Types Made

  • Feature / Enhancement (non-breaking change).
  • PowerShell code changes.

Change Checklist

  • PowerShell code changes: PowerShell v3 compatibility checked? (Not a package, not relevant for build scripts)
  • All items are are completed on the Definition of Done.

Related Issue

@AdmiringWorm

Copy link
Copy Markdown
Member Author

Keeping this PR in draft to avoid issues when back-merge happens at a later time.

@AdmiringWorm AdmiringWorm added the Build Automation Issues for changes to the build system, without functional changes needed to the project. label Apr 15, 2026
@AdmiringWorm AdmiringWorm added this to the vNext milestone Apr 15, 2026
@AdmiringWorm AdmiringWorm assigned AdmiringWorm and vexx32 and unassigned vexx32 Apr 15, 2026
@AdmiringWorm AdmiringWorm requested a review from vexx32 April 15, 2026 11:32

@vexx32 vexx32 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, was there a need for this to stay in draft?

@AdmiringWorm AdmiringWorm marked this pull request as ready for review May 20, 2026 15:37
@AdmiringWorm

Copy link
Copy Markdown
Member Author

LGTM, was there a need for this to stay in draft?

Uhm, no. This one hadn't needed to stay in draft.

@AdmiringWorm AdmiringWorm force-pushed the support-packages-config-and-csproj branch from 5705d1b to 5607b88 Compare May 20, 2026 15:39
Update Get-ChocoUpdatedDebugVersion.ps1 to handle both legacy
packages.config and modern csproj package management formats. Add
detection logic to determine which format is in use and adjust paths
accordingly. Change build target from Restore to Init for proper project
initialization.

Key Changes:
- Add conditional logic to detect and parse either packages.config or
  .csproj files for chocolatey.lib version
- Store detection result in isNewCsproj flag for downstream path logic
- Update chocolateyLibPackageFolder path construction based on project
  format
- Change build.debug.bat target from Restore to Init
- Add fallback logic for code_drop library path with net48 subdirectory
  support
- Throw descriptive error if neither package format is found

Reason for the change:
- Support modern SDK-style csproj projects alongside legacy
  packages.config format
- Ensure script works with both old and new project structures
- Improve build initialization process with Init target
- Handle varying directory structures in chocolatey code_drop output
Update the build initialization to establish a dependency
chain that ensures strong name signing occurs before the
main initialization task completes.

Key Changes:
- Add InitTask dependency on Strong-Name-Signer task
- Ensure proper task execution order in build pipeline

Reason of the change:
- Guarantee strong name signing happens at the correct point in the
  build process
- Prevent error images for packages due to unsigned Splat library

Notes:
- This only affects debug builds, and the assemblies are properly signed
  during release time compilations.
@vexx32 vexx32 force-pushed the support-packages-config-and-csproj branch from 5607b88 to 6bfbb28 Compare May 22, 2026 19:35
@vexx32 vexx32 merged commit ba841bb into chocolatey:develop May 22, 2026
2 checks passed
@AdmiringWorm AdmiringWorm modified the milestones: vNext, 3.2.0 May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build Automation Issues for changes to the build system, without functional changes needed to the project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants