The standard Wong-Viner envelope theorem is of little use in the context of production with multiple outputs because the differentiability assumptions its builds on are so severely restrictive that even the simplest of applications fail to satisfy them. Common sources of this failure are capacity constraints, which lead to nonsmooth joint costs. However, the analysis can be extended to the case of general convex costs by using subdifferential calculus. A reformulation of the original theorem is also required, and we do this by reinterpreting the capital input optimality condition in valuation terms, viz., as the equality of marginal rental values of the fixed inputs to their rental prices. This form of the condition is not only sufficiently stronger but also easier to use because the short-run profit function can actually be differentiable (in the fixed inputs) even when the short-run cost is not. Remarkably, this can be so even with fixed-coefficients techniques, as we demonstrate. The extended Wong-Viner theorem can serve as a proper basis for a short-run approach to the implementation of long-run marginal cost pricing by a public utility supplying a good with cyclical demands and prices. This generalises the Boiteux-Dreze analysis of purely thermal electricity generation to any (convex) technology supplying a good differentiated over time and/or other characteristics. As an application, a case study of electricity generation combined with energy storage techniques (viz., pumped storage and storage hydro) is presented. It gives, for the first time, a sound method of calculating efficiency rents for the fixed assets, such as the special geological sites suitable for the provision of reservoirs. A basic advantage of the analysis to a publicly-owned utility is the guarantee that the short-run marginal costs are correctly identified as long-run marginal costs.