[12376] Fixed build in release mode for vs2012.

Now must build propertly in any build mode combinations

[ci skip]