Covalent organic frameworks (COFs) offer a strategy to position molecular semiconductors within a rigid network in a highly controlled and predictable manner. The π-stacked columns of layered two-dimensional COFs enable electronic interactions between the COF sheets, thereby providing a path for exciton and charge carrier migration. Frameworks comprising two electronically separated subunits can form highly defined interdigitated donor-acceptor heterojunctions, which can drive the photogeneration of free charge carriers. Here we report the first example of a photovoltaic device that utilizes exclusively a crystalline organic framework with an inherent type II heterojunction as the active layer. The newly developed triphenylene-porphyrin COF was grown as an oriented thin film with the donor and acceptor units forming one-dimensional stacks that extend along the substrate normal, thus providing an optimal geometry for charge carrier transport. As a result of the degree of morphological precision that can be achieved with COFs and the enormous diversity of functional molecular building blocks that can be used to construct the frameworks, these materials show great potential as model systems for organic heterojunctions and might ultimately provide an alternative to the current disordered bulk heterojunctions.