Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TeamCity publish using Visual Studio 2015

I've read many articles on publishing from TeamCity using various versions of Visual Studio. I'm currently using v.9.1.7 of TeamCity and Visual Studio 2015.

I have my 3 build steps on check-in:

  • Clean & Rebuild
  • Unit Test
  • Publish

Build Steps

When I check in my files I get a Tests Passed success message:

Tests Passed

I can tell from here something isn't right as I'm expecting it to say something about publishing. When I look at the Build Log I see the following:

[12:48:22][API\API.sln] Publish [12:48:22][Publish] MSBuild [12:48:22][MSBuild] API\API\API.csproj: Build target: Publish [12:48:22][API\API\API.csproj] _DeploymentUnpublishable

My Publish Build Step is setup this way:

Publish Build Step

In my API project in Visual Studio I can publish to the correct location on the network. Here is my publish profile:

Visual Studio Publish Profile

I'm not sure what I'm missing. I'm expecting the Publishing build step to work like when I click the Build->Publish menu item in Visual Studio.

I'm guessing that I'm missing something or misunderstanding what the publishing build step is supposed to do.

Any help is appreciated.

like image 753
webdad3 Avatar asked May 14 '16 13:05

webdad3


2 Answers

I was able to get it to work after days and days of searching. I found part of the answer here on Stack Overflow. The trick was to get it to work from the MSBuild Command Line:

C:\TFS\project\myProject\APIproject>msbuild apiproject.csproj /p:DeployOnBuild=true /p:PublishProfile="Properties\PublishProfiles\DEV.pubxml" /p:VisualStudioVersion=14.0

Once I got this running several times I was able to create a Build Step in Team City (see this question/answer) and I set the following:

  • Build file path: <location of the apiproject.csproj>
  • MSBuild version: Microsoft Build Tools 2015
  • MSBuild ToolsVersion: 14.0
  • Run platform: x86
  • Command Line Parameters: /p:DeployOnBuild=true /p:PublishProfile= "C:\TFS\API\API\Properties\PublishProfiles\DEV.pubxml" /p:VisualStudioVersion=14.0
like image 162
webdad3 Avatar answered Nov 08 '22 07:11

webdad3


IIRC, publishing from TeamCity requires certain files or alternatively VS installed on the build agent (which really isn't recommendable). Have you copied the necessary files to the build agent?

like image 1
Hadi Hariri Avatar answered Nov 08 '22 08:11

Hadi Hariri