'Upgrading VS2017 from 15.4.1 to 15.5.1 resulted in build error

I'm programming with the following tools/versions: Windows 10 / VS2017 Professional / C++

After I upgraded to 15.5.1 I got the following error:

MIDL2338: switches are contradictory - no_robust vs. - target

The Microsoft compiler error description list says: You cannot use both the /osf and /ms_ext command-line switches when you compile an IDL file.

None of those switches are specified in my project properties.

I tried to downgrade back to 15.4.1 but have found that it's impossible to revert to an old version unless it's N-1. This is based on the many blogs I've read (including Stack Overflow).

I have hit a wall and am at a standstill until I figure out this switch issue.

Your help would be greatly appreciated.



Solution 1:[1]

In order to remove the /no_robust flag (if generated stubs don't need to be run on Microsoft Windows NT, Windows 95/98, or Windows Me), simply remove the

<ValidateAllParameters>false</ValidateAllParameters>

entries under the <Midl> element in the .vcxproj files.

Source: ref

Solution 2:[2]

One more reference answer for MIDL2338 vs MIDL1024 errors. https://developercommunity.visualstudio.com/t/build-fails-from-from-msbuild-command-line-with-er/207580

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 CJBS
Solution 2 Nguyen Si Anh