We have an Azure DevOps build pipeline task generating the message "Compiling assembly bitcode files with -O2 ...". See "Output from DevOps task" (identified with >>> and <<<).
My question is how I can change the option, i.e. emcc parameter, from -O2 to -O3 in order to have more optimization? The info for -O2 and -O3 is available at Emscripten Compiler Frontend (emcc).
I followed the instruction available at ASP.NET Core Blazor WebAssembly build tools and ahead-of-time (AOT) compilation for enabling the WASM AOT compilation but I can't find anything on how to specify -O3. It looks like the -O2 is the default value.
Output from DevOps task:
##[section]Starting: dotnet publish Release==============================================================================Task : .NET CoreDescription : Build, test, package, or publish a dotnet application, or run a custom dotnet commandVersion : 2.153.3Author : Microsoft CorporationHelp : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli==============================================================================[command]C:\Windows\system32\chcp.com 65001Active code page: 65001[command]"C:\Program Files\dotnet\dotnet.exe" publish C:\agent\_work\3\s\OrderEntry\OrderEntryUI\UI\OrderEntryUI.csproj --configuration Release Determining projects to restore... Restored C:\agent\_work\3\s\OrderEntry\OrderEntryWS\DTO\DTO.csproj (in 123 ms). Restored C:\agent\_work\3\s\OrderEntry\OrderEntryUI\Resources\Resources.csproj (in 123 ms). Restored C:\agent\_work\3\s\OrderEntry\OrderEntryUI\UI\OrderEntryUI.csproj (in 893 ms). DTO -> C:\agent\_work\3\s\OrderEntry\OrderEntryWS\DTO\bin\Release\net8.0\OrderEntryWS.DTO.dll Resources -> C:\agent\_work\3\s\OrderEntry\OrderEntryUI\Resources\bin\Release\net8.0\Resources.dll [Telerik and Kendo UI Licensing] Telerik and Kendo UI License Key found at: TELERIK_LICENSE_PATH=C:\Users\SRoy\Desktop\Telerik\telerik-license.txt (EnvironmentVariablePath) License issued at 2025-04-04 to s*******.r**@b******.com. [Telerik and Kendo UI Licensing] Valid BLAZOR license found. [Telerik and Kendo UI Licensing] Valid Telerik Document Processing Libraries license found. OrderEntryUI -> C:\agent\_work\3\s\OrderEntry\OrderEntryUI\UI\bin\Release\net8.0\OrderEntryUI.dll OrderEntryUI (Blazor output) -> C:\agent\_work\3\s\OrderEntry\OrderEntryUI\UI\bin\Release\net8.0\wwwroot Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink Optimizing assemblies for size. This process might take a while. DTO -> C:\agent\_work\3\s\OrderEntry\OrderEntryWS\DTO\bin\Release\net8.0\OrderEntryWS.DTO.dll Resources -> C:\agent\_work\3\s\OrderEntry\OrderEntryUI\Resources\bin\Release\net8.0\Resources.dll Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink AOT'ing 126 assemblies [1/126] BitumarAuth.dll -> BitumarAuth.dll.bc [2/126] Blazored.FluentValidation.dll -> Blazored.FluentValidation.dll.bc [3/126] AutoMapper.Extensions.EnumMapping.dll -> AutoMapper.Extensions.EnumMapping.dll.bc [4/126] Blazored.LocalStorage.dll -> Blazored.LocalStorage.dll.bc [5/126] Flurl.dll -> Flurl.dll.bc [6/126] Microsoft.AspNetCore.Authorization.dll -> Microsoft.AspNetCore.Authorization.dll.bc [7/126] AutoMapper.dll -> AutoMapper.dll.bc ... ... [124/126] Telerik.Blazor.dll -> Telerik.Blazor.dll.bc [125/126] System.Private.CoreLib.dll -> System.Private.CoreLib.dll.bc [126/126] aot-instances.dll -> aot-instances.dll.bc Compiling native assets with emcc with -Oz. This may take a while ... [1/3] pinvoke.c -> pinvoke.o [took 6.63s] [2/3] corebindings.c -> corebindings.o [took 7.39s] [3/3] driver.c -> driver.o [took 7.87s]>>> Compiling assembly bitcode files with -O2 ... <<< [1/126] AutoMapper.Extensions.EnumMapping.dll.bc -> AutoMapper.Extensions.EnumMapping.dll.o [took 3.31s] [2/126] BitumarAuth.dll.bc -> BitumarAuth.dll.o [took 3.54s] [3/126] Blazored.FluentValidation.dll.bc -> Blazored.FluentValidation.dll.o [took 3.54s] [4/126] Blazored.LocalStorage.dll.bc -> Blazored.LocalStorage.dll.o [took 3.45s] [5/126] Microsoft.AspNetCore.Authorization.dll.bc -> Microsoft.AspNetCore.Authorization.dll.o [took 2.49s] ... ... [122/126] netstandard.dll.bc -> netstandard.dll.o [took 2.34s] [123/126] System.Private.Xml.dll.bc -> System.Private.Xml.dll.o [took 83.37s] [124/126] System.Private.CoreLib.dll.bc -> System.Private.CoreLib.dll.o [took 75.41s] [125/126] Telerik.Blazor.dll.bc -> Telerik.Blazor.dll.o [took 267.64s] [126/126] aot-instances.dll.bc -> aot-instances.dll.o [took 221.04s] Linking for initial memory $(EmccInitialHeapSize)=57344000 bytes. Set this msbuild property to change the value. Linking with emcc with -O2. This may take a while ..."C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Node.win-x64\8.0.19\tools\bin\node.exe" "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Sdk.win-x64\8.0.19\tools\emscripten\src\compiler.js" C:\Windows\SERVIC~1\NETWOR~1\AppData\Local\Temp\tmp4du0kg_e.json --symbols-only"C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Sdk.win-x64\8.0.19\tools\bin\wasm-ld.exe" @C:\Windows\SERVIC~1\NETWOR~1\AppData\Local\Temp\emscripten_5dfn0qw4.rsp.utf-8"C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Node.win-x64\8.0.19\tools\bin\node.exe" "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Sdk.win-x64\8.0.19\tools\emscripten\src\compiler.js" C:\Windows\SERVIC~1\NETWOR~1\AppData\Local\Temp\tmphpq5wvhf.json"C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Sdk.win-x64\8.0.19\tools\bin\wasm-opt" --strip-dwarf --post-emscripten -O2 --low-memory-unused --zero-filled-memory --pass-arg=directize-initial-contents-immutable --strip-debug --strip-producers C:\agent\_work\3\s\OrderEntry\OrderEntryUI\UI\obj\Release\net8.0\wasm\for-publish\dotnet.native.wasm -o C:\agent\_work\3\s\OrderEntry\OrderEntryUI\UI\obj\Release\net8.0\wasm\for-publish\dotnet.native.wasm -g --mvp-features --enable-exception-handling --enable-mutable-globals --enable-sign-ext --enable-simd"C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Node.win-x64\8.0.19\tools\bin\node.exe" "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.3.1.34.Sdk.win-x64\8.0.19\tools\emscripten\tools\acorn-optimizer.js" C:\Windows\SERVIC~1\NETWOR~1\AppData\Local\Temp\emscripten_temp_vv98a31x\dotnet.native.js JSDCE minifyWhitespace --exportES6 -o C:\Windows\SERVIC~1\NETWOR~1\AppData\Local\Temp\emscripten_temp_vv98a31x\dotnet.native.jso1.js Stripping symbols from dotnet.native.wasm ... OrderEntryUI -> C:\agent\_work\3\s\OrderEntry\OrderEntryUI\UI\bin\Release\net8.0\publish\##[section]Finishing: dotnet publish ReleasePipeline YAML although we are using the classic editor:
pool: name: Defaultsteps:- task: DeleteFiles@1 displayName: 'Delete files from $(Build.BinariesDirectory)' inputs: SourceFolder: '$(Build.BinariesDirectory)' Contents: '**/*'- task: NuGetToolInstaller@1 displayName: 'Use NuGet '- task: NuGetCommand@2 displayName: 'NuGet restore' inputs: restoreSolution: '$(Build.SourcesDirectory)\OrderEntry\OrderEntryUI\UI\OrderEntryUI.csproj' feedsToUse: config nugetConfigPath: OrderEntry/OrderEntryUI/UI/NuGet.Config externalFeedCredentials: TelerikNuGetV3- task: DotNetCoreCLI@2 displayName: 'dotnet restore others' inputs: command: restore projects: '$(Build.SourcesDirectory)\OrderEntry\OrderEntryUI\UI\OrderEntryUI.csproj' feedsToUse: config nugetConfigPath: OrderEntry/OrderEntryUI/UI/NuGet.Config externalFeedCredentials: TelerikNuGetV3 enabled: false- task: DotNetCoreCLI@2 displayName: 'dotnet build Release' inputs: projects: '$(Build.SourcesDirectory)\OrderEntry\OrderEntryUI\UI\OrderEntryUI.csproj' arguments: '--configuration Release ' enabled: false- task: DotNetCoreCLI@2 displayName: 'dotnet publish Release' inputs: command: publish publishWebProjects: false projects: 'OrderEntry\OrderEntryUI\UI\OrderEntryUI.csproj' arguments: '--configuration Release' zipAfterPublish: false- task: ArchiveFiles@2 displayName: 'Archive to zip' inputs: rootFolderOrFile: '$(Build.SourcesDirectory)/OrderEntry/OrderEntryUI/UI/bin/Release/net8.0/publish/' includeRootFolder: false archiveFile: '$(Build.SourcesDirectory)/OrderEntry/OrderEntryUI/UI/bin/Release/net8.0/publish.zip' verbose: true- task: CopyFiles@2 displayName: 'Copy publish.zip to $(Build.ArtifactStagingDirectory)' inputs: SourceFolder: '$(System.DefaultWorkingDirectory)' Contents: | **\publish.zip TargetFolder: '$(Build.ArtifactStagingDirectory)' CleanTargetFolder: true flattenFolders: true- task: PublishBuildArtifacts@1 displayName: 'Publish Artifact: OrderEntryUIDrop' inputs: ArtifactName: OrderEntryUIDropThanks in advance
Stéphane