runtime: Error: AOT Support throws the error "PublishTrimmed is implied by native compilation and cannot be disabled".

Description

Once created the WinUI project in Visual Studio, Just upgrade the SDK version. Added the PublishAOT tag as true. Tried to publish the exe through the below command,

dotnet publish -c release -r win-x64

but it throws the error in output window

C:\Users\.nuget\packages\microsoft.dotnet.ilcompiler\8.0.8\build\Microsoft.NETCore.Native.Publish.targets(55,5): Error : PublishTrimmed is implied by native compilation and cannot be disabled.

Reproduction Steps

NA

Expected behavior

Once added the PublishAOT tag in project, the project should works as expected in AOT.

Actual behavior

Throws error while running the project

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (12 by maintainers)

Most upvoted comments

Also did you check you don’t have PublishTrimmed hardcoded to false in your .pubxml files?