Creating a second-generation Managed Package (2GP) that has a dependency on a released first-generation Managed Package (1GP).
This is what I want the version progression for the package Connector for Salesforce to be:
Version Name | Version Number | Notes |
---|---|---|
Aurora 2023 | 2.1.0.7 | Last release of first-generation managed package |
Aurora 2023.2 | 2.1.1.1 | First release of second-generation managed package |
Got the information about my 1GP (namespace = xyzzy) from its Packaging and Namespace Org with:
sfdx force:package1:version:list -u [email protected]
MetadataPackageVersionId | MetadataPackageId | Name | Version | ReleaseState | BuildNumber |
---|---|---|---|---|---|
04t... | 033.. | Aurora 2023 | 2.1.0 | Released | 7 |
On my Dev Hub ([email protected]), I linked my namespace (with [email protected]) then created a 2GP like this:
sfdx force:package:create --name "Connector for Salesforce" --packagetype Managed --path force-app/
NAME | VALUE |
---|---|
Package Id | 0Ho... |
Now for the sfdx-project.json...
{
"namespace": "xyzzy",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "56.0",
"packageDirectories": [
{
"default": true,
"package": "Connector for Salesforce",
"path": "force-app",
"versionName": "Aurora 2023.2",
"versionNumber": "2.1.1.NEXT",
"definitionFile": "config/project-scratch-def.json",
"dependencies": [
{
"package": "Connector for Salesforce (1GP)@2.1.0.7"
}
]
}
],
"packageAliases": {
"Connector for Salesforce": "0Ho...",
"Connector for Salesforce (1GP)@2.1.0.7": "04t...",
"Connector for Salesforce (1GP)": "033..."
}
}
When I run
sfdx force:package:beta:version:create -p 0Ho... --installationkeybypass -b next
After recommendations from @Phil W below, the error is now...
ERROR running force:package:version:create: Can’t create patch version. Log a case in the Salesforce Partner Community and request that patch versioning be enabled in the org where you created the namespace for this package.
UPDATE: This error occurred because I was trying to make the first version of my second-generation managed package 2.1.0.NEXT instead of 1.0.0.NEXT. The reason I chose that version was to create continuity with my 1GP. Patch versioning was not needed. The error message from it was erroneous (and unhelpful).
sfdx-project.json
comparing this with the detail you provided above that. If this is what you've done then you cannot; a 1GP cannot depend on a 2GP. If that's not what you've done I would say that you have the structure the wrong way round in thesfdx-project.json
...sfdx-project.json
? What's still going wrong?