Why is CRT preferred to be dynamic in Windows? #96911
-
It is noticed that CRT builds seems to be preferring to use ucrt.lib (and maybe vcruntime.lib) instead of their static counterpart Which is easily countered with: <ItemGroup>
<SdkNativeLibrary Include="libucrt.lib" />
<SdkNativeLibrary Include="libvcruntime.lib" />
<LinkerArg Include="/NODEFAULTLIB:ucrt.lib" />
<LinkerArg Include="/NODEFAULTLIB:vcruntime.lib" />
</ItemGroup> So that my final NativeAOT executable is free of CRT. While a workaround is already available, I'm just curious on why? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
UCRT is part of all Windows versions that are supported in .NET. It makes little sense to link it statically. We do link the VCRuntime part statically because that one is not part of Windows. |
Beta Was this translation helpful? Give feedback.
-
Thank you for supporting me! @MichalStrehovsky,
It looks fine. But what does
That is really funny if you don't have |
Beta Was this translation helpful? Give feedback.
UCRT is part of all Windows versions that are supported in .NET. It makes little sense to link it statically. We do link the VCRuntime part statically because that one is not part of Windows.