Microsoft recently changed Visual Studio 2017 behavior to set the current folder to a default directory when any Developer tools are run.
When 'model.bat' calls 'vcvarsall.bat', it will change the current folder to the default directory which is not the 'model_grt_rtw' directory. Thus, 'nmake' will not be able to find 'model.mk' file.
As discussed in the above Bug Report, the temporary fix is to set an environment variable in MATLAB by executing the command below at MATLAB Command Window:
>> setenv('VSCMD_START_DIR','%CD%')
Add this to matlabrc to ensure it is set at startup. This will result in successful builds. However, this may cause a harmless 'project path cannot be found' message during build.
This bug was fixed as of <https://www.mathworks.com/downloads/web_downloads/download_update?release=R2017b&s_tid=ebrg_R2017b_1_1649009 R2017b Update 1>.
If you have a current subscription to MathWorks Software Maintenance Service (SMS), you can download the product updates. If not, learn more about <https://www.mathworks.com/services/maintenance/ MathWorks SMS>.
Best Answer