Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CI/CD of a ASP.NET Core Web API using VSTS

I have created an ASP.NET Core Web API app using Visual Studio 2017 (Community Edition). I could successfully publish to an Azure App Service using Visual Studio.

I now want to set up CI/CD using VSTS. I used the 'Configure Continuous Delivery' option from Visual Studio which created a project in VSTS and created a build definition. I had to create a new build definition based on the 'ASP.NET Core' template in VSTS in order to avoid Nuget restore errors. The solution now builds and the tests are run but the 'Publish' task completes with a warning-

##[warning]No web project was found in the repository. Web projects are identified by the presence of either a web.config file or wwwroot folder in the directory. 

The 'Publish Artifact' task has a similar warning -

##[warning]Directory 'd:\a\1\a' is empty. Nothing will be added to build artifact 'drop'. 

And obviously, the build does not produce any artifacts.

Do I need to add any build tasks to the default ASP.NET Core build template? How can I publish my Web API to Azure using VSTS?

like image 853
alwayslearning Avatar asked Oct 11 '17 17:10

alwayslearning


People also ask

Is Vsts a CI CD tool?

The Visual Studio IDE can simplify the configuration of CI and CD using the Continuous Developer Tools (bit.ly/2ha7MtE) built into Visual Studio 2017 Update 3.


1 Answers

As the warning message, your repository seems has no web project. So you should deselect the Publish Web Projects option in .NET Core publish task, and specify your .csproj in project(s) option.

enter image description here

And you can also find the hint message for Publish Web Projects option as below:

If true, the task will try to find the web projects in the repository and run the publish command on them. Web projects are identified by presence of either a web.config file or wwwroot folder in the directory.

like image 102
Marina Liu Avatar answered Oct 20 '22 20:10

Marina Liu