The Western sees the lack of order on the American frontier as simultaneously a severe moral danger and an opportunity for beauty and greatness. The Western Hero is an Evangelist for the American gospel of individualism and capitalism, bringing order to the perilous disorder of the open, free West.
By contrast, the noir/hardboiled detective doesn't view his action as redemptive, either for himself or the world. For the former, because we are not redeemers - we are helpless and require redemption. For the latter, because evil is a corruption, a lack and not a thing itself. You can't destroy a corruption because it has no content. You can only repair it in small, isolated moments. The hardboiled detective takes a case, and solves that case. He doesn't heal the land.
But that's a really wide brush and these genres seem to have influenced each other a lot. Dashiell Hammett's "Red Harvest" became the foundation of the hardboiled detective novel in the United States, but it also became "Yojimbo" under Kurasawa's care and "Fistful of Dollars" under Sergio Leone's. Criterion recently had a collection called "Western Noir" that also dealt with the substantial overlap in these categories. So even though I like to grandstand about the ideological separation of these two genres, it's not destiny - and plenty of folks have told a Western story with a hardboiled moral arc. And vice versa, I suppose. Though I think hardboiled accidents with Western substance is a bit more ideologically rigid - you can usually tell those ones because the detective will be a cop.
All this is to say that I don't really like Westerns because they are often a type of propaganda that I don't like. Propaganda's fine, if it's propagating something true. But the war against the disorder-as-wilderness in the Western treats the process of re-order as something laudable when it was built on the twin lies of free land (taken by force from American Indians) and free labor (taken by force from black slaves). The Western genre did a ton of working laundering that as something constructive, rather than destructive - necessary brutalities to build a civilization where men could live freely.
"Walleye, a lot of things are going to go wrong in your life that technically aren't your fault. Always remember that this doesn't make you any less of an idiot"