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.
CmdLine@2task to run thedotnetcommands to see if it can work. Fore more details, see my answer below. @Sunil Krishna kanth