dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.25k stars 4.73k forks source link

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

Open sudharsan-narayanan opened 11 hours ago

sudharsan-narayanan commented 11 hours ago

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

dotnet-policy-service[bot] commented 11 hours ago

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas See info in area-owners.md if you want to be subscribed.

huoyaoyuan commented 11 hours ago

What's your .NET SDK and WinUI version?

Sergio0694 commented 1 hour ago

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