---
schema_version: "1"
id: 157d098bf50326156b07a8e69435037ab24af5d8ffe61f03f958ece15d6a77e9
title: Adding Apex Code to a AppExchange App
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/apex_intro_AppExchange.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_intro_AppExchange.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: b34d3694716bc03f49a5dae803b5006a22cd823a7a48ba3b441df510d78e9521
description: You can include an Apex class or trigger in an app that you’re creating for AppExchange.
---
# Adding Apex Code to a AppExchange App

You can include an Apex class or trigger in an app that you’re creating for AppExchange.

Any Apex that is included as part of a package must have at least 75% cumulative test coverage. Each trigger must also have some test coverage. When you upload your package to AppExchange, all tests are run to ensure that they run without errors. In addition, tests with the@isTest(OnInstall=true) annotation run when the package is installed in the installer's organization. You can specify which tests should run during package install by annotating them with @isTest(OnInstall=true). This subset of tests must pass for the package install to succeed.

For more information, see the [Second-Generation Managed Packaging Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.pkg2_dev.meta/pkg2_dev/sfdx_dev_dev2gp.htm).