webdad3
webdad3

Reputation: 9080

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:

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.

Upvotes: 8

Views: 8576

Answers (5)

webdad3
webdad3

Reputation: 9080

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

Upvotes: 8

Pramod Raut
Pramod Raut

Reputation: 697

You can use MSBuild runner to Deploy your Application/API enter image description here

Add Command line parameter :

/t:Clean /p:DeployOnBuild=true /t:build /t:publish /p:PublishProfile=C:\_works\teamcity\publishprofiles\Publiush_Profile.pubxml /p:VisualStudioVersion=12.0

PublishPrfile URL should be your publish profile path.

This will work for you.

Upvotes: 1

daniel
daniel

Reputation: 1

VS will probably find your publish profile with just the name, like: /p:DeployOnBuild=true;/p:PublishProfile=DEV; very useful if you run more than one build agent.

And if you're deploying to an IIS you might need to add AllowUntrustedCertificate=true;

Upvotes: 0

user2421985
user2421985

Reputation:

Where are artifacts location defined. And you can use Tentacles for publishing build into various environments. I guess, you need to look towards artifacts configurations.

Upvotes: 1

Hadi Hariri
Hadi Hariri

Reputation: 5016

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?

Upvotes: 1

Related Questions