Skip to main content
2 of 5
added 503 characters in body

The extent to which the answer to your question is no is analysed by Milnor's exact sequence. You can write $M$ as the colimit of a sequence $M_n \subset M_{n+1}$ of cofibrations with $M_n$ compact (at least if $M$ is a manifold but much more generally). Then there is a "short exact sequence" of pointed sets $$ \{1\} \to \textstyle{\lim^1_n} [\Sigma M_n, N]_* \to [M,N]_* \to \lim_n [M_n,N]_* \to \ast $$ (in the usual sense that the map of pointed sets on the right is surjective and its fibers are orbits of the action of the group $\lim^1$ which acts on the set in the middle). Brayton Gray used this sequence to construct the example that Mark Grant mentions in the comments above in this paper (since $S^3$ is simply connected there is no difference between pointed and unpointed homotopy classes).

Another reference for the Milnor exact sequence is Bousfield and Kan, Homotopy Limits, Completions and Localizations, Corollary IX.3.3.

Edit (I had not noticed the second question): Assuming you can pick the inclusions $M_n \to M_{n+1}$ in a compact exhaustion to be cofibrations (i.e. to have the homotopy extension property) and $M$ has the weak topology determined by the $M_n$ (which will happen in the case of a manifold) then you can patch the nulhomotopies of the $M_n \to M$ together to construct a contraction of $M$. An argument where a homotopy is constructed in this way appears again in the proof of Lemma 2.34 in Hatcher.