I have created a sample Website project with a single page having HellowWord.aspx and HellowWord.aspx.cs. I am trying to create an Azure DevOps build pipeline for this project. The following are the tasks I have added to my build package.

But the publish artifacts always contains the aspx and aspx.cs file. Not sure which tasks I am supposed to add to make the proper publish package. Which will create proper dlls for .aspx file instead of aspx.cs.

Publish build artifactstask has an argumentPath to publish, which defines the folder or file path to publish. This can be a fully-qualified path or a path relative to the root of the repository. Wildcards are not supported. Variables are supported. Example:$(Build.ArtifactStagingDirectory). By default, this argument uses variable$(Build.ArtifactStagingDirectory).So you need to check your
Copy filestask, to see what you have copied to$(Build.ArtifactStagingDirectory), and copy the correct files in this task.https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/copy-files?view=azure-devops&tabs=yaml