azure-devopsbuild-pipelinedotnetcorecli

Azure Devops build pipeline doesn't build executables


I setup an azure build pipeline with the following Yaml

enter image description here

This project is a simple hello world console application, written in c# .net core 3.1

When I build or publish this project locally I get the following output:

However, the published Artifacts through the build pipeline gives me these files:

So here, the file sizes are smaller, and more importantly the TestYaml.exe is missing and is replaced by a TestYaml file.

This should be rather straightforward, but I don't see what's missing.

Thanks in advance for the help!


Solution

  • Azure Devops build pipeline doesn't build executables

    That because:

    Executables aren't cross-platform. They're specific to an operating system and CPU architecture. When publishing your app and creating an executable, you can publish the app as self-contained or runtime-dependent.

    So, it will generate the .dll instead of .exe file when you build/publish the project with ubuntu agent. This dll file works across all platforms that are supported by the .net core runtime (windows, linux, macOS).

    To generate the .exe file, you could specify the target runtime in the arguments -r win-x64 or you can just simple to change agent to the windows.

    Please check this thread and the document for some more details.

    Hope this helps.