pcpm convert
Migrate an existing solution into a PCPM workspace.
pcpm convert [options]
pcpm convert is a one-shot migration command. It takes an
existing .NET solution (with or without Central Package
Management) and turns it into a PCPM workspace.
What it does
- Walks the workspace, collecting every
<PackageReference />. - Adopts your existing
Directory.Packages.propsif you have one; otherwise creates one. - Strips
Version="…"from every<PackageReference />and writes the version as a<PackageVersion />in CPM. - Writes
pcpm.json. - With
--workspace, writespcpm-workspace.yamlcovering all projects. - Runs
pcpm installto materialise the store and writepcpm.lock.
Options
| Flag | Effect |
|---|---|
--workspace | Also write pcpm-workspace.yaml. |
--no-install | Skip the implicit pcpm install. |
--no-cpm | Don’t create or touch Directory.Packages.props. |
--force | Re-run even if pcpm.json already exists. |
--backup | Snapshot every modified file to pcpm-convert.bak/ before editing. |
Examples
# Standard migration
pcpm convert
# Monorepo migration
pcpm convert --workspace
# Migration that doesn't change the lockfile
pcpm convert --no-install
What it doesn’t change
pcpm convert is conservative. It does not:
- Touch anything other than the files described above.
- Update package versions. It normalises what you have.
- Change your NuGet feed configuration.
- Modify the build graph or properties.
Rolling back
pcpm convert is git-friendly. The full set of changes is
visible in git status:
git status
# On branch main
# Changes to be committed:
# new file: pcpm.json
# modified: Directory.Packages.props
# modified: src/Api/Api.csproj
# ...
To roll back:
git restore .
If you used --backup, the originals are in
pcpm-convert.bak/ and can be restored manually.
See also
- Migrating from CPM — full guide.
pcpm init— for greenfield projects.