So far, we have been using either scratch Org or developer Org to build our code components and tests. However, to publish the components on AppExchange, we need to package the solution as a managed package. A managed package adds a namespace string to the fields, objects, classes, and components, and bundles all the dependencies into one unit. Manage-packaging the solution generates a URL link that can be used to install the solution in any Salesforce instance.
To package up the application as a managed package, we need a developer Org with a namespace. A developer Org can be obtained freely using the following URL: https://developer.Salesforce.com/signup.
To namespace an Org, navigate to the Package Manager from the setup using the Setup | Apps | Package Manager path:
The package manager screen provides Edit buttons on Developer Settings. Choose a namespace for the application you want to package, as shown in the following screenshot:
Let's assume we are packaging up all the code we have for the YouTubeSearch application. Let's also assume that the name of the package is the YouTubeSearch application and the namespace we have chosen is SearchApp. Note that you can edit the application name any time, however, you cannot change the namespace.
The following screenshot shows how you can create a package and manage it using a checkbox. Note that a Salesforce instance can have only one managed package application: