About locally compact groups without compact subgroups

Is every Hausdorff, locally compact group that does not contain any non-trivial compact group, finitely dimensional?

• @NickS it's the topological dimension. So a discrete group has dimension 0, is not a counterexample. – YCor Mar 8 at 6:46

Yes, it's even a Lie group whose unit component is a semidirect product $$R\rtimes S^n$$, where $$R$$ is a simply connected solvable Lie group and $$S$$ is the universal covering of $$\mathrm{SL}_2(\mathbf{R})$$.
Indeed, by van Dantzig, every locally compact group $$G$$ has an open subgroup $$U$$ such that $$U/U^\circ$$ is compact. By the solution to Hilbert's fifth problem, $$U$$ has a compact normal subgroup $$W$$ such that $$U/W$$ is Lie (necessarily with finitely many components). Hence, in the current setting, $$W=1$$, so $$U$$ is Lie and $$U^\circ=G^\circ$$ is open in $$G$$.
Every connected Lie group with maximal compact subgroup $$K$$ is homeomorphic to $$\mathbf{R}^d\times K$$ for some $$d$$ (Iwasawa). Hence, $$G^0$$ is homeomorphic to $$\mathbf{R}^d$$ for some $$d$$. Being simply connected, it is semidirect product $$R\rtimes T$$ with $$R$$ its radical, necessarily simply connected, and $$T$$ a semisimple Levi factor, simply connected and hence $$T$$ is a direct product of simple simply connected Lie group. The only possibility for such simple factor to be contractible is indeed the 3-dimensional $$S$$.
Proposition. A locally compact group $$G$$ has no nontrivial compact subgroup iff $$G$$ is Lie (i.e., $$G^0$$ is Lie and open) and the discrete quotient $$G/G^0$$ is torsion-free.
Proof: clearly, these are necessary conditions. Conversely, suppose that $$G$$ has no nontrivial compact subgroup. By the above, $$G^0$$ is open and is a contractible Lie group. We claim that $$G/G^0$$ is torsion-free (note that this is not so immediate since the surjection $$G\to G/G^0$$ may not be split). Otherwise, let $$F$$ be a nontrivial finite subgroup of $$G/G^0$$, and let $$H$$ be its inverse image in $$G$$: this is an open subgroup of $$G$$, which is Lie, virtually connected but not connected. A result of Mostow (valid in any virtually connected Lie group $$H$$) is that $$H^0K=H$$ for some compact subgroup $$K$$ of $$H$$. So $$K=\{1\}$$. Hence $$H^0=H$$, thus $$H$$ is connected, contradiction.