Make sure that you install the correct version of Visual Studio that is compatible with your MATLAB release:
Note that the Community (free), Professional, and Enterprise editions of Visual Studio 2017, 2019, and 2022 are supported for use with MATLAB/Simulink. Express, Preview and Code editions are not supported. Build Tools for Visual Studio 2022 and 2019 have been supported since MATLAB R2023b.
Reach out to your IT helpdesk for assistance with downloading, installing, and licensing Visual Studio.
While running the installer for Visual Studio, make sure that the "Desktop development with C++" workload is selected, as shown in the screenshot below. This will make sure that the actual Visual Studio C++ (MSVC) compiler and all necessary dependencies are installed on your system.
To verify if this workload is installed for your existing installation, open Visual Studio IDE and go to Tools > Get Tools and Features, which opens the Visual Studio Installer.
Additional Notes: