Skip to content

MSVCRT build warning when building Windows App SDK (WinUI) release binaries with native AOT #3928

@kirwan-safesurfer

Description

@kirwan-safesurfer

Package

Sentry

.NET Flavor

.NET

.NET Version

8.0.12

OS

Windows

SDK Version

5.0.1

Self-Hosted Sentry Version

No response

Steps to Reproduce

(Please find a minimal project attached below.)

  1. In Visual Studio 2022, create a Blank App, Packaged (WinUI 3 in Desktop), and add Sentry 5.0.1 as a NuGet package. Set the project to Release mode and apply Native AoT (right-click project > Properties > Build > Publish > enable Publish native AOT).
  2. Add the WinUI (with trimming) code to the project.
  3. Package the project (right-click project > Package and publish > Create App Packages, and create a Release x64 MSIX binary).

During the Release build, after mentioning Generating native code, the build log will output the following warning: LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

I was able to discover this by using PowerShell:

cd "C:\Users\User\source\repos\Project\src\Project"

Get-ChildItem -Recurse | Select-String "msvcrt" -List | Select Path | Format-List *

Path : C:\Users\User\source\repos\Project\src\Project\bin\ARM64\Release\net8.0-windows10.0.26100.0\win-arm64\Sentry.dll

Path : C:\Users\User\source\repos\Project\src\Project\bin\Release\net8.0-windows10.0.26100.0\win-arm64\publish\Sentry.dll

Path : C:\Users\User\source\repos\Project\src\Project\bin\Release\net8.0-windows10.0.26100.0\win-x64\publish\project.exe

Path : C:\Users\User\source\repos\Project\src\Project\bin\Release\net8.0-windows10.0.26100.0\win-x64\publish\project.pdb

Path : C:\Users\User\source\repos\Project\src\Project\bin\x64\Debug\net8.0-windows10.0.26100.0\win-x64\Sentry.dll

Path : C:\Users\User\source\repos\Project\src\Project\bin\x64\Debug\net8.0-windows10.0.26100.0\win-x64\AppX\Sentry.dll

Path : C:\Users\User\source\repos\Project\src\Project\bin\x64\Release\net8.0-windows10.0.26100.0\win-x64\Sentry.dll

Path : C:\Users\User\source\repos\Project\src\Project\bin\x64\Release\net8.0-windows10.0.26100.0\win-x64\AppX\Sentry.dll

Path : C:\Users\User\source\repos\Project\src\Project\bin\x64\Release\net8.0-windows10.0.26100.0\win-x64\native\project.exe

Path : C:\Users\User\source\repos\Project\src\Project\bin\x64\Release\net8.0-windows10.0.26100.0\win-x64\native\project.pdb

Path : C:\Users\User\source\repos\Project\src\Project\obj\ARM64\Release\net8.0-windows10.0.26100.0\win-arm64\linked\Sentry.dll

Path : C:\Users\User\source\repos\Project\src\Project\obj\ARM64\Release\net8.0-windows10.0.26100.0\win-arm64\R2R\Sentry.dll

Path : C:\Users\User\source\repos\Project\src\Project\obj\x64\Release\net8.0-windows10.0.26100.0\win-x64\linked\Sentry.dll

Path : C:\Users\User\source\repos\Project\src\Project\obj\x64\Release\net8.0-windows10.0.26100.0\win-x64\native\project.obj

Path : C:\Users\User\source\repos\Project\src\Project\obj\x64\Release\net8.0-windows10.0.26100.0\win-x64\R2R\Sentry.dll

Expected Result

No warning should appear in the build log.

Actual Result

LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

Minimal project (SentryAotTest.zip)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingWindows

    Projects

    Status

    Done

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions