GitHub Actions: set the EnableWindowsTargeting property to true.

Github actions generally run on Ubuntu Platform for any application targeting .NET5 or .NET6, But if it’s a application targeting Windows Platform then running the workflow on Ubuntu will display an error stating as shown below (The error occurs because the application targets Windows Platform but you are trying to run the build on Linux)

To build a project targeting Windows on this operating system, set the EnableWindowsTargeting property to true.

This error can be easily solved be editing the workflow yaml file and configuring the build to run on Windows machine rather than on Ubuntu machines as shown below. Edit the runs-on to use “windows-latest” instead of “ubuntu-latest”

After modifying the yml file, the build got executed successfully without any issues.



You may also like...