0

I'm trying to build my .Net MAUI application(which targets Android and Windows) in Azure Devops Pipeline. My Android pipeline is building successfully. However, Windows is giving below error.

error CS5001: Program does not contain a static 'Main' method suitable for an entry point

I'm using .NetCoreCLI@2 task to build the project. Below is my yaml configuration for the same:

- task: DotNetCoreCLI@2
  displayName: 'Build MAUI Application'
  inputs:
    command: publish
    publishWebProjects: false
    projects: IFSINTEGRATOR/IFSINTEGRATOR.sln
    arguments: '-c Release -f net7.0-windows10.0.19041.0'
    zipAfterPublish: false
    modifyOutputPath: false

I'm able to successfully build in my local machine withthe same command dotnet publish -c Release -f net7.0-windows10.0.19041.0 in Developer Command Prompt for VS2022.

Can you help me in successfully building the Windows app in the pipeline by resolving the above issue?

I tried multiple tasks like Powershell, DOTNETCORECLI etc to build the project and all are throwing the same error.

1
  • You can try to use the CmdLine@2 task to run the dotnet commands to see if it can work. Fore more details, see my answer below. @Sunil Krishna kanth Commented Apr 30, 2024 at 6:42

1 Answer 1

0

You can try to use the CmdLine@2 task to run the dotnet commands in your pipeline like as below.

jobs:
- job: build
  steps:
  - task: UseDotNet@2
    displayName: 'Use .NET 7'
    inputs:
      version: 7.x

  - script: 'dotnet workload restore IFSINTEGRATOR/IFSINTEGRATOR.sln'
    displayName: 'Install workloads'

  - script: 'dotnet publish IFSINTEGRATOR/IFSINTEGRATOR.sln -c Release -f net7.0-windows10.0.19041.0'
    displayName: 'Build MAUI Application'
Sign up to request clarification or add additional context in comments.

1 Comment

Hi @Bright Ran-MSFT tried the approach suggested. But still seeing the same issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.