Build Mongod from source code

Hi @Pavan_Kumar9 -

Currently, no stable branches of MongoDB support builds with VS 2022, and the version of SCons we have vendored on those branches is entirely unaware of VS 2022, so it won’t find it anyway.

For now, you will need to install VS 2019 to build any stable MongoDB release from source. However, on the master branch, we just recently upgraded the required version of VS to be VS 2022, and updated our internal version of SCons to be aware of it.

If you are interested in the changes required in order to build with VS 2022, you can review the commits that introduced support here:

Note that with these changes in place, you don’t need to run a dressed shell or worry about having the right cl.exe in the PATH: SCons will find it for you.

Since we have never tested building stable releases (e.g. MongoDB v5.x or older) with VS 2022, compilation of those branches may or may not succeed if you adopted the above changes, and the resulting binaries may or may not work.

The next Major Release, MongoDB 6.0, will be compatible with and require VS 2022.

Thanks,
Andrew