Today I installed a new version of Windows SDK through VS installer. Everything started working.
I think there is a problem with SDK 10.0.19041.0 which is the default SDK for VS 2022. When using this SDK compiler doesn’t get complete library paths so it fails when looking for ucrtd.lib. I can see that $(WindowsSDK_LibraryPath_x64) misses ucrt directory. Installation of new SDK fixes this. It looks like a msbuild’s internal SDK-detection problem.