Error Publishing .NET Core App in Azure DevOps YAML Build
A dev quickly walks us through an error he received when working in .NET Core and how he fixed it with a little YAML.
Join the DZone community and get the full member experience.Join For Free
short story, i've created a simple yaml build for a .net core project where one of the tasks publishes a simple .net core console application. after running the build i got a strange error in the output:
no web project was found in the repository. web projects are identified by presence of either a web.config file or wwwroot folder in the directory.
this is extremely strange, because the project is not a web project, it is a standard console application written for .net core 2.2, so i do not understand why it is searching a web.config file.
then i decided to create a standard non-yaml build, and when i dropped the task on the build i immediately understood the problem
this happens because .net core task with the
command is assuming, by default, that a web application is going to be published.
since i hae no web project to publish i
immediately changed my yaml definition to explicitly set the
property to false.
- task: dotnetcorecli@2 displayname: .net core publish inputs: command: publish projects: '$(serviceproject)' arguments: '--output $(build.artifactstagingdirectory)' configuration: $(buildconfiguration) workingdirectory: $(serviceprojectdir) publishwebprojects: false zipafterpublish: true
and the build was fixed.
Published at DZone with permission of Ricci Gian Maria, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.