An optimization approach for the seismic design of yielding moment-resisting frames (MRFs) with nonlinear fluid viscous dampers (FVDs) is presented. As the optimal design of new buildings is addressed, no parameters are set a priori, and the properties of both the structural elements and the dampers are simultaneously optimized. The goal of the optimization is to minimize the cost of the system (structure + dampers), while code requirements and performance constraints are considered. The performance of the structure is evaluated using a nonlinear time history analysis (NTHA), accounting for the nonlinear behavior of both the MRF elements and the added FVDs. The optimization problem is first formulated as a mixed-integer problem suitable for a solution by zero-order optimization. Then, the problem is reformulated in a continuous differentiable form and solved using an efficient gradient-based optimization approach. This is done by utilizing discrete material optimization (DMO) functions to achieve a good initial design for the cross-sections and the FVDs. This initial design accounts for the important aspects of design, some directly and some indirectly. The responses of interest are computed using a probabilistic approach while considering ensembles of ground motions. Numerical examples show the robustness of the presented methodology and its efficiency demonstrated on a five-story MRF and a real-scale irregular ninestory MRF.