Reputation: 9080
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:
When I check in my files I get a Tests Passed success message:
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:
In my API project in Visual Studio I can publish to the correct location on the network. Here is my 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
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:
<location of the apiproject.csproj>
/p:DeployOnBuild=true /p:PublishProfile= "C:\TFS\API\API\Properties\PublishProfiles\DEV.pubxml" /p:VisualStudioVersion=14.0
Upvotes: 8
Reputation: 697
You can use MSBuild runner to Deploy your Application/API
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
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
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
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