Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 584
user20358 Avatar asked Feb 01 '16 15:02

user20358


People also ask

How do I publish API in Visual Studio 2019?

Publish Web API from Visual StudioRight click on Web API project and click “Publish” menu. Now click “Ok” and move on Connection tab in Publish Web.

How do I publish a Visual Studio project locally?

Right-click on the project (not the solution) in Solution Explorer and select Publish. In the Publish tab, select Publish. Visual Studio writes the files that comprise your application to the local file system. The Publish tab now shows a single profile, FolderProfile.

How do I publish a Visual Studio project to a server?

On the computer where you have the ASP.NET project open in Visual Studio, right-click the project in Solution Explorer, and choose Publish. If you have previously configured any publishing profiles, the Publish pane appears. Click New or Create new profile. Select the option to import a profile.


1 Answers

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.

like image 67
Eddie Chen - MSFT Avatar answered Nov 15 '22 09:11

Eddie Chen - MSFT