How do I include a file dynamically into a TeamCity build - teamcity

I am fairly new to TeamCity and have recently been tasked with creating various builds, which I have done with no real issues.
What I am trying to do now though is include an external text file into the build output.
The external text file will be received from a service call made during the build.
These are my intended build steps:
Check out solution.
Restore packages.
Run tests.
Call web service with a configurable parameter and receive text file back.
Include text file in build.
Deploy.
Steps 1,2,3 and 6 are covered.
What are my options here? I must confess I do not really know where to begin.
I've spent some time today googling but it has been tricky getting the correct search term to return information on what I am trying to achieve.
I've seen some confusing articles on a 'meta runner'.
Any pointers to get me started in the right direction would be much appreciated.
Thanks.

Use a TeamCity command line build step - https://confluence.jetbrains.com/display/TCD9/Command+Line
I assume you are using build steps for all the other steps you listed so this is simply another of those.
The command line process would run somewhere under your checkout folder and thus anything it downloads would be made available as an artifact for your build

Related

Sonar-Scanner - Maintaining a list of 'broken' files to skip

I've got a copy of sonar-scanner using a plugin that's still early in its development life. At the moment it seems to have some trouble with some particular files that prevent the scan from completing.
I'd like to build a list of files that should be skipped over as part of the scan process so that I can at least scan the rest of our code. Is there any way I can can have sonar.exclusions read from a file. I'd prefer this because:
The list is expected to be quite long, and I'm worried about exceeding a length limitation for sonar.exclusions
It would be ideal to be able to easily add to this list as needed (so a file I can just append to would be preferable).
(And before anyone asks, I'm already working with the vendor to fix the bug in the affected plugin - I just want a way to proceed with implementing SonarQube so I can proceed with getting the analysis pipeline setup while they're working on the fix).
Ok, so my "solution" is only a partial solution, I still have to add new files manually when I encounter an issue that breaks the plugin.
But it also turns out that sonar.exclusions doesn't appear to have a length limit (or, if it does, it's very generous).

In TeamCity how can I use an xcode build step on a project that is created in an earlier step?

I have a build system that takes an Expo React-Native project and 'ejects' the underlying iPhone app build project (the xcodeproj and workspace etc)
however as these files don't exist at the time I am creating the build steps the wizard that wants to help me find the scheme cannot find the file and so cannot set itself up.
What is my work around here? Do I have to devolve back to a command line only system (I am not sure how to do that!) or can I trick TeamCity in some way.
I don't have a solution for this yet... but it is clear that the command line is king here and my complete solution will involve https://docs.fastlane.tools/ in some way.

How to run MSBuild file after TFS done building successfully?

So, i recently set up an TFS build server, server could build and test, not problems there, however i found out that MsBuild cant publish to ftp directly. so i search on the internet, of what exactly i can do to solve my problem.
I found ms build tasks extension which have possibility to publish files to ftp. The problem i am facing right now is that i cant really figure out how to use it. I am using default build process template, with few changes. I dont understand if i have to change that template, or i have to write a brand new template? Or do i have to change in VS project file? or how do i get started? I never worked with MSBuild before. So the question is, how do i get started?
There are plenty information on the internet, but i couldnt find a plain dummy explanation of how to integrate this library and make it work together with TFS.
You would be better to love your ftp your to PowerShell.
If you use the TfvcTemplate.12.xaml you should see a post test script location. Here you can specify a PowerShell to fun after your build has finished and tests have passed. This would be much easeyer to support long term.

Display NCover coverage report inside TeamCity

I am running NCover 3, with TeamCity 7. TeamCity is kicking off the cover process and I can find the fullcoveragereport.html in my file directory for the build, however TeamCity is not creating a tab for the coverage.
I cant view this Ncover fullcoveragereport.html inside of TeamCity. I think it has to do with my report tab settings, under the start page section, it says
"Relative path from the root of build's artifacts to a start page of the generated report.
To reference a file from an archive, use the [path-to-archive]![relative-path] syntax." Is this in reference to the build server machine, that is, I want to point it from the .buildserver folder to the coverage.zip folder?
I now get a "This is an autogenerated index file (there was no index.html found in the generated report)." in the coverage tab, I think I am getting close...
Any ideas, or things I might have missed?
So it seems as though using many missread the documentation and put in //
as the parameter . They also put in FullCoverageReport:Html:{teamcity.report.path}.
In actuality it should be one entire string with the or in there which throws some people off.
//or FullCoverageReport:Html:{teamcity.report.path}
In this scenario (im not 100% sure why), this still didnt work. I was pleased to find out that
//or Summary:Html:{teamcity.report.path}
Will work. Its not as verbose as the full NCover report but it beats an empty index.html file.
it turns out there is an issue with the FullReport with NCover 3 and TeamCity 7 , read more about it below.
http://youtrack.jetbrains.com/issue/TW-20635
I'm going to try some of the other reporting commands (see below) and see if i can make an ad-hoc FullCoverageReport to suffice.
http://docs.ncover.com/kb/reports-available-in-ncover-classic-and-ncover-complete/

how should I go about replicating VS2010's Publish command?

I'm trying to build a publish script that doesn't use VS2010 -- I want it to be automated and in powershell (may use Psake soon). The biggest issue that I run into is that a project that will build and publish fine in VS2010 will either not build or not publish via the msbuild command. The closest I can get is (anonymized code):
msbuild /p:OutDir=c:\temp\publish\staging\myProj\myProj_1481\;Configuration=Debug;UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False C:\TEMP\export\myProj\1481\src\myProj.com\myProj.csproj
That one is failing for a Could not find file error in one of the DLLs. Naturally it publishes fine from VS2010. Is there some sort of recursion that I need to do? I'm burning up quite a bit of time on this one particular portion of my script -- the one part I have the least control over.
Requirements:
if the proj will build in VS2010 I shouldn't need to modify the csproj file -- I don't want to hand this script off to someone else and have them stick in "fix your csproj" land for hours per project
have to be able to script it entirely at the command line
hopefully no additional installs needed
Related:
Trying to Build and Publish Asp.net website from command line using aspnet_compiler (old)
_CopyWebApplication with web.config transformations (didn't fix my issue)

Resources