Search code examples
visual-studio-2013tfsbuildtfsbuildazure-devops

Build not publishing Web API project in Visual Studio Team Services (was VS Online)


I have created a VS build definition on Team Services. The build runs successfully when I queue it and it also outputs the dlls for all the projects in the solution except the service layer which I have created using Web Api2.

when I download the artifacts from the drop location, I have folders holding the dlls for the data layer, the business layer and other helper projects. What I don't have is the main service layer dll which I can deploy to my IIS.

Here is a screenshot of my publish settings.

enter image description here

What could I be missing ?


Solution

  • It seems that you are using the default settings for the build definition. With these settings, the contents for "Copy Files" task is "**\bin\$(BuildConfiguration)**" while web api project does not have buildconfiguration folder. So it cannot find the files for web api project. To copy these files, add one more "Copy Files" task and configure the settings as following: enter image description here

    If you want the deployment files for the project, you need to set you build definition as following:

    1. Add arguments /p:DeployOnBuild=true;OutDir="$(build.artifactstagingdirectory)" for Visual Studio Build step.
    2. Remove Copy Files step.
    3. Set Path to Publish to $(build.artifactstagingdirectory)\\_PublishedWebsites for Publish Build Artifacts step.

    Then you should get the deployment files in the drop folder.