`msbuild` of `vcxproj` in Release configuration is referencing Debug runtime

I have a simple C project which warps a x64 MASM project. When this builds in Release configuration the resulting dll still references VCRUNTIME140D.dll and VCRUNTIME140_1D.dll which I understand are debug versions of the runtime. This is causing a The specified module could not be found. (0x8007007E) error when run on a machine with the normal runtime installed.

What do I need to change to build against the release runtime?

The definition group for Release|x64 looks like this:

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v143</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>EMULATORCODE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
      <PrecompiledHeader>Use</PrecompiledHeader>
      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
      <Optimization>Disabled</Optimization>
      <RemoveUnreferencedCodeData>false</RemoveUnreferencedCodeData>
    </ClCompile>
    <Link>
      <SubSystem>Windows</SubSystem>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
      <GenerateDebugInformation>false</GenerateDebugInformation>
      <EnableUAC>false</EnableUAC>
    </Link>
    <CustomBuild>
      <Command>echo</Command>
    </CustomBuild>
  </ItemDefinitionGroup>

With the commandline msbuild "EmulatorCore.vcxproj" /p:configuration=Release /p:platform=x64 , the output is as follows:

MSBuild version 17.8.5+b5265ef37 for .NET Framework
Build started 11/05/2024 15:27:41.

Project "EmulatorCore.vcxproj" on node 1 (default targets).
PrepareForBuild:
  Structured output is enabled. The formatting of compiler diagnostics will reflect the error hierarchy. See https://aka.ms/cpp/structured-output for more details.
InitializeBuildStatus:
  Creating "x64ReleaseEmulatorCore.tlogunsuccessfulbuild" because "AlwaysCreate" was specified.
  Touching "x64ReleaseEmulatorCore.tlogunsuccessfulbuild".
CustomBuild:
  Performing Custom Build Tools
  Microsoft (R) Macro Assembler (x64) Version 14.38.33134.0
  Copyright (C) Microsoft Corporation.  All rights reserved.

   Assembling: core.asm
ClCompile:
  C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.38.33130binHostX64x64CL.exe /c /Zi /nologo /W3 /WX- /diagnostics:column /sdl /Od /Oi /GL /D EMULATORCODE_EXPORTS /D _WINDOWS /D _USRDLL /D _WINDLL /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /pe
  rmissive- /Yc"pch.h" /Fp"x64ReleaseEmulatorCore.pch" /Fo"x64Release\" /Fd"x64Releasevc143.pdb" /external:W3 /Gd /TP /FC /errorReport:queue pch.cpp
  pch.cpp
  C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.38.33130binHostX64x64CL.exe /c /Zi /nologo /W3 /WX- /diagnostics:column /sdl /Od /Oi /GL /D EMULATORCODE_EXPORTS /D _WINDOWS /D _USRDLL /D _WINDLL /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /pe
  rmissive- /Yu"pch.h" /Fp"x64ReleaseEmulatorCore.pch" /Fo"x64Release\" /Fd"x64Releasevc143.pdb" /external:W3 /Gd /TP /FC /errorReport:queue EmulatorCore.cpp dllmain.cpp ym_wrapper.cpp
  EmulatorCore.cpp
  dllmain.cpp
  ym_wrapper.cpp
Link:
  C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.38.33130binHostX64x64link.exe /ERRORREPORT:QUEUE /OUT:"x64ReleaseEmulatorCore.dll" /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
   /MANIFEST /MANIFESTUAC:NO /manifest:embed /PDB:"x64ReleaseEmulatorCore.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /LTCG:incremental /LTCGOUT:"x64ReleaseEmulatorCore.iobj" /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"x64ReleaseEmulatorCore.lib" /MACHINE:X64 /DLL x64Releasecore.obj
  x64Releasedllmain.obj
  x64ReleaseEmulatorCore.obj
  x64Releasepch.obj
  x64Releaseym_wrapper.obj
     Creating library x64ReleaseEmulatorCore.lib and object x64ReleaseEmulatorCore.exp
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library [EmulatorCore.vcxproj]
  Generating code
  Previous IPDB not found, fall back to full compilation.
  All 317 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
  Finished generating code
  EmulatorCore.vcxproj -> x64ReleaseEmulatorCore.dll
FinalizeBuildStatus:
  Deleting file "x64ReleaseEmulatorCore.tlogunsuccessfulbuild".
  Touching "x64ReleaseEmulatorCore.tlogEmulatorCore.lastbuildstate".
Done Building Project "EmulatorCore.vcxproj" (default targets).

But I still get the debug dependencies:

Microsoft (R) COFF/PE Dumper Version 14.38.33134.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file emulatorcore.dll

File Type: DLL

  Image has the following dependencies:

    MSVCP140.dll
    VCRUNTIME140_1D.dll
    VCRUNTIME140D.dll
    ucrtbased.dll
    KERNEL32.dll

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật