Several engineering systems currently use microchannel heat sinks. In order to increase the performance of these devices, optimisation according to the first and second law of thermodynamics is employed. One way to achieve the goal is to modify the geometry of the cross-section, as is done in this paper for square ducts, having the walls at a uniform temperature which is higher than that of the bulk fluid at the inlet. The effects of both the thermal entry region of the duct and the heat generation due to viscous dissipation are considered. The resulting Graetz–Brinkman problem is solved numerically to obtain the velocity and temperature fields. It is demonstrated that non-negligible viscous heating eventually causes the heat flux to reverse (from fluid to walls), and that, only after this condition is achieved, can the flow become fully developed, which makes the entry region the only useful stretch for real-life applications. The length after which the direction of the heat flux reverses due to viscous heating in the fluid is obtained as a function of the Brinkman number and of the smoothing radius. Optimisation with performance evaluation criteria and entropy generation minimisation was carried out separately, and the results were combined into a single objective function. A comparison with published models highlights how neglecting the entry region and viscous heating yields misleading results. It turns out that smoothing the corners is always profitable in the case of the constrained heated perimeter or area of the cross-section but seldom when the characteristic length or the hydraulic diameter is fixed. With few exceptions, viscous heating amplifies the trends experienced for zero-Brinkman flows. The results are in non-dimensional form, yet they have been obtained starting from plausible dimensional values and are applicable to real-life devices.