bluedot
bluedot

Reputation: 782

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!

Upvotes: 3

Views: 2346

Answers (2)

Krzysztof Madej
Krzysztof Madej

Reputation: 40663

The issue is that you build locally on Windows and on Azure DevOps on ubuntu. If you change your pool to windows-latest you will get your exe file. Please take look alo here - Build .NET Core console application to output an EXE

Upvotes: 0

Leo Liu
Leo Liu

Reputation: 76770

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.

Upvotes: 7

Related Questions