I'm having difficulty getting Teamcity to properly call my publish profiles in a build step. I can run the publish profiles through visual studio locally, but when they run on the build server all that happens is an aspnet_client folder is created. I have the 2013 build tools installed on the server, but I'm not sure what's wrong. According to teamcity, it completes successfully, but nothing appears to be happening.
Here's the build step configuration :
Runner type : MSBuild
Build file Path : <project sln file>
MSBuild Version : Build Tools 2013
MSBuild ToolsVersion : 12.0
Run Platform : x86
Command line parameters : /p:PublishProfile=Test /p:Platform="Any CPU" /p:DeployOnBuild=true /p:Configuration=Release
Here are the log entries for that step :
[07:56:50]Step 2/3: Publish (MSBuild) (5s)
[07:56:50][Step 2/3] Starting: C:\BuildAgent3\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MsBuildBootstrap.exe /workdir:C:\BuildAgent3\work\8f604242f6a86ba2 "/msbuildPath:C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe"
[07:56:50][Step 2/3] in directory: C:\BuildAgent3\work\8f604242f6a86ba2
[07:56:52][Step 2/3] SpindustryGitPlayground\SpindustryGITPlayground.sln.teamcity: Build target: TeamCity_Generated_Build (2s)
[07:56:53][SpindustryGitPlayground\SpindustryGITPlayground.sln.teamcity] TeamCity_Generated_Build (2s)
[07:56:53][TeamCity_Generated_Build] MSBuild (2s)
[07:56:53][MSBuild] SpindustryGitPlayground\SpindustryGITPlayground.sln: Build default targets (2s)
[07:56:53][SpindustryGitPlayground\SpindustryGITPlayground.sln] ValidateSolutionConfiguration
[07:56:53][ValidateSolutionConfiguration] Building solution configuration "Release|Any CPU".
[07:56:53][SpindustryGitPlayground\SpindustryGITPlayground.sln] Build (2s)
[07:56:52][Build] MSBuild command line parameters contain "/property:" or "/p:". It is recommended to define System Property on Build Parameters instead.
[07:56:53][Build] MSBuild (2s)
[07:56:53][MSBuild] SpindustryGitPlayground\SpindustryGITPlayground.metaproj: Build default targets (2s)
[07:56:53][SpindustryGitPlayground\SpindustryGITPlayground.metaproj] Build (2s)
[07:56:53][Build] AspNetCompiler (2s)
[07:56:53][AspNetCompiler] C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /SpindustryGITPlayground -p ..\SpindustryGITPlayground\ -u -f PrecompiledWeb\SpindustryGITPlayground\
[07:56:52][MSBuild] MSBuild command line parameters contain "/property:" or "/p:". It is recommended to define System Property on Build Parameters instead.
[07:56:52][Step 2/3] MSBuild command line parameters contain "/property:" or "/p:". It is recommended to define System Property on Build Parameters instead.
[07:56:55][Step 2/3] Process exited with code 0
This used to work (or at least I could have swore it did), but now I've tried everything I can think of. Any help would be greatly appreciated!
Hi Jason,
Please try to run the same build via command line on the same machine as the TeamCity agent and under the same user that the agent is running. Does the build run successfully? For more details see the guideline.
It is doing that. In further investigation it sounds like command line MSBuild will not do the file copy step in the publish profile. It creates the compiled site, but doesn't run the file system publish step. I went ahead and created a console application that now handles the transfer portion of the build.
Hi Alina ,
My issue is Artifacts are not generated for success projects (Build) for few times, saying that the path is not found.
Here I added detailed steps. Please have a look and help me to get the artifacts every time for success Projects (builds).
We are using TeamCity Enterprise 2017.1.2 for CI and CD for .Net applications and we have 2 build agents. We have configured many projects.
Default Artifact directories is: system\artifacts
Case1.Artifacts generated successfully: build is published and deployed to QA environment successful.
We have option in TeamCity like Artifacts path at project (Build) level where i have mentioned path like below. And this path is related to checkout directory.
GHY.GK.Wcf\DeploymentResources\_PublishedWebsitesGHY.GK.Wcf_Package => Services_Package
GHY.GK.Web\DeploymentResources\_PublishedWebsites\GHY.GK.Web_Package => Web_Package
Artifacts generated successful with below message:
[Publishing artifacts] Collecting files to publish: [GHY.GK.Wcf/DeploymentResources/_PublishedWebsites/GHY.GK.Wcf/_Package => Services_Package, GHY.GK.Web\DeploymentResources\_PublishedWebsites\GHY.GK.Web_Package => Web_Package]Artifacts generated successfully: The artifacts path is at individual build
[12:41:02][Publishing artifacts] Publishing 5 files using [ArtifactsCachePublisher]: GHY.GK.Wcf/DeploymentResources/_PublishedWebsites/GHY.GK.Wcf_Package => Services_Package
[12:41:02][Publishing artifacts] Publishing 5 files using [WebPublisher]: GHY.GK.Wcf/DeploymentResources/_PublishedWebsites/GHY.GK.Wcf_Package => Services_Package
[12:41:03][Publishing artifacts] Publishing 5 files using [ArtifactsCachePublisher]: GHY.GK.Web/DeploymentResources/_PublishedWebsites/GHY.GK.Web_Package => Web_Package
[12:41:03][Publishing artifacts] Publishing 5 files using [WebPublisher]: GHY.GK.Web/DeploymentResources/_PublishedWebsites/GHY.GK.Web_Package => Web_Package
Case 2. Artifacts are not generated for few times for the same Project (build) and Artifacts path is same like above.
Error Message below : Saying that path is not found.
Please help me on this.
This error message means that the specified folder is not found among the generated files. This is an issue with the build process, and your build isn't generating those folders. As the folders don't exist, TeamCity cannot copy them or their contents to the artifacts. This should be easy to check, after the error happens, double check the folder on the build agent and see that they don't exist.
Why they aren't being created might be found on the build log, if the build process logs information about those steps. Unfortunately, this is obviously dependent on your project so it would be hard for us to point out why your build doesn't generate such files.
If your local build consistently creates those artifacts but it fails in teamcity, please follow the steps here to debug and report the issue: https://confluence.jetbrains.com/display/TCD10/Common+Problems#CommonProblems-BuildworkslocallybutfailsormisbehavesinTeamCity
Thank you, Denis.
I will cross verify whether the folders exist or not on both the agents? and will go through the link provided by you hopefully this will help me. I will let you know the status on this.
Hi Denis,
Now I'm able to get the Artifacts.
As guided by you I gone through build log. The problem is agent is not able to create the folder mentioned in Artifacts path.
For this I have added the command in build step /p:OutDir=DeploymentResources as Im published the code though Runner type as Msbuild. Then it is generating Artifacts for Every project.
Hi Denis,
I'm struggling to understand artifacts dependency.
I have to use the same artifacts (above generated package) to upgrade the staging environment?
Step1: For this I have created new project with Artifact Dependencies below. Artifacts are downloaded from previous build to checkout directory (destination path).
Step2: Where i have specify this destination directory to tell Teamcity that to pick this package and upgrade the staging environment? I need to specify in Build step OR in Parameters section? How I need to configure the build step Runner Type (MSBuild) or any?
For regular projects we have configured build step runer type as Msbuild and given build file path is .sln or .csproj. and used commands to deploy the code to QA environment. see below image. Application is successfully deployed code & generated artifacts.
Step3: For Artifacts dependency how I have to specify the build step to deploy the package (using available Artifacts of previous build) to UAT environment or Production environment?
Please help me..
I'm afraid there isn't "a" way to get this job done. When using artifact dependencies, the artifacts are copied into the working directory (or subdirectories) as you have mentioned. From here, how to use them depends on your process, target server, etc. Common scenarios here are to upload via ftp, upload and/or run commands via ssh, or use some other third party deployers, such as artifactory or octopus deploy.
How do you normally deploy this artifacts (that is, outside teamcity)
Hi Denis,
For now we are manually copying(Ctrl+C) the Artifacts from QA server and moving them to staging/production server.
Then we are upgrading the staging/Production instance manually.
Scope is to upgrade the staging/production instances through Teamcity with the available Artifacts.
Hi Denis,
1. How to exclude/skip few files/folders (web.config, .xml , certificate(folders) ..etc) when creating package? I don't want this files in my package.
For this I have used -:**/certificate => Api.csproj.zip, but no luck
How I have to specify to skip the above files?
I have gone through Build log, First Team City is creating package and then deploying to respective environment.
2. How to exclude/avoid few files/folders (web.config, .xml , folders ..etc) when deploying?
For this I have added in build step of ms build command as below.
/p:ExcludeFilesFromDeployment="Web.config"
/p:ExcludeFilesFromDeployment="Content"
But it is avoiding only web.config file when deploying. I have avoid multiple folder/files as well. How can i achieve this?