The increasing share of weather-dependent renewable energy sources amplifies the influence of weather uncertainty on the design of urban energy systems. Consequently, selecting representative weather years has become a critical challenge for ensuring resilient and cost-optimal system configurations. However, the impact of different weather years and design approaches on system resilience has not yet been systematically assessed. This study investigates how weather years affect the outcome of deterministic urban energy system design optimization approaches, including perfect-foresight and rolling-horizon optimization. Furthermore, the influence of demand-side flexibility on system resilience is evaluated. An urban energy system optimization model focused on the heating sector, with jointly optimizing district heating network expansion and building-specific supply technologies, is applied. System resilience is assessed using the indicators loss-of-load, loss-of-load duration (stability), robustness, and cost-optimality across 68 historical and future weather years. The results show that robustness increases exponentially with the calculated design peak demand. Demand-side flexibility mainly improves system stability by reducing the 95th percentile of the sequential loss-of-load duration from approximately 100 to below 15 hours. The typical meteorological year performs worse than most actual weather years, yielding the 17th-highest median cumulative loss-of-load with 842 MWh. The design year 2018 results in the most robust system configuration, with zero hours of load loss, but also the highest system costs. However, future weather years derived from IPCC scenarios demonstrate high robustness with improved cost-effectiveness. The best trade-off between cost-optimality and robustness is achieved using the design year 1971. Overall, the findings demonstrate that weather-year selection strongly influences the outcomes of urban energy system design. Furthermore, the proposed rolling-horizon optimization approach enhances system robustness, underscoring the importance of accounting for additional peak capacities in the design process.