The tax doesn't apply to unsold investments or unrealized capital gains. Stock shares won't incur taxes until they're sold no matter how long the shares are held or how much they increase in value.
For the target, a stock sale is usually a nonevent from a tax perspective. The buyer in a stock sale does not get a step-up in tax basis in the assets that comprise the target company, and thus is not able to increase their depreciation and amortization deductions in the same way as in an asset sale.
The short answer is that a stock sale is better for you, the seller, while the buyer benefits from an asset sale. But, since we're talking about the IRS, there are infinite variations and complications. As such, you will want to get professional tax and legal advice before proceeding.
Disadvantages of Asset Sale The seller is subject to a double layer of taxation. Transferring assets may be more complicated. Agreements tied to certain assets may need to be renegotiated.
Stocks are financial assets. They're not real assets. A financial asset is a liquid asset that gets its value from a contractual right or ownership claim.
Almost everything you own and use for personal or investment purposes is a capital asset. Examples of capital assets include a home, personal-use items like household furnishings, and stocks or bonds held as investments.
In an asset sale, the ownership of these acquired assets would change hands, with the buyer negotiating separately for each asset. In a stock sale, ownership of such assets does not change hands in the same way. The target still retains its ownership typically, even if the target has a new owner.