TITLE: Is a locally free sheaf projective in the category of $\mathcal{O}_X$-modules when $X$ is an affine scheme?
QUESTION [15 upvotes]: Let $X$ be an affine scheme and $\mathcal{E}$ a finitely generated locally free sheaf on $X$. It is obvious that $\mathcal{E}$ is a projective object in the category Qcoh$(X)$ since we can pass to rings and modules. 
My question is: is $\mathcal{E}$ still projective when we consider it in the larger category  $\mathcal{O}_X$-mod which consists of all $\mathcal{O}_X$-modules? If it is true, how to prove it in a "cohomological way"?
I'm not sure whether this question is suitable for mathoverflow. Please feel free to move it if necessary.

REPLY [19 votes]: This answer is inspired by the discussion at this question. Let $X$ be an integral affine scheme admitting an open cover $X=U\cup V$ with $U$, $V$ and $X$ all distinct. I claim that $\mathscr O_X$ is not projective in $\operatorname{Mod}(\mathscr O_X)$. Let $i\colon U\hookrightarrow X$ and $j\colon V\hookrightarrow X$ be the inclusion morphisms. There is an obvious surjection $p\colon i_! \mathscr O_U\oplus j_! \mathscr O_V\twoheadrightarrow \mathscr O_X$ (check surjectivity on stalks). If $\mathscr O_X$ were projective, $p$ would split, so we would have $\Gamma(\mathscr O_X)\hookrightarrow \Gamma(i_!\mathscr O_U)\oplus \Gamma(j_! \mathscr O_V)=0$, a contradiction.