Mr. Trump first offered condolences for those killed and injured during a shooting at a California synagogue, then continued by heavily emphasizing trade relations with China, the healthy economy and his preferences on Federal Reserve policy. At times, the president had to rouse the crowd to the usual noise levels by deploying a reliable set of keywords: “Democrats,” “the media,” “the swamp.”

The less raucous rally was perhaps partly because of what is politically at stake for Republicans in Wisconsin, where three recent presidential elections were decided by the closest margins in the country. It is already presenting itself as a prime battleground territory before 2020, with Democrats planning to have their convention next year in Milwaukee.

One of the most visible industries here is also in peril. Dairy farmers in the state known for its cheese are reeling from the president’s trade wars as over 1,200 farms have stopped milking cows. But when Mr. Trump said his administration’s repeal of the estate tax would help farmers, the crowd still cheered.

Tailoring his speech to Midwesterners on the shores of Lake Michigan, Mr. Trump trumpeted local victories. He praised armored vehicle manufacturers in Oshkosh, and told the crowd his administration was earmarking $300 million to the Great Lakes Restoration Initiative. (His budget calls for cutting the program by 90 percent this year.)

“Now you finally have a president that is loyal to you,” Mr. Trump said, mostly reserving mockery for his prospective opponents.

“Can you imagine Sleepy Joe, Crazy Bernie?” he asked. “Can you imagine any of those people up here doing what I’m doing?”

As he attacked the usual hit list of Democrats, journalists and prospective 2020 presidential candidates, Mr. Trump detailed his policy victories and denounced his perceived enemies for any setbacks or losses. He again blamed John McCain, the Republican senator of Arizona, for dismantling a Republican plan to overhaul the health care system.