Getting the TeamCity build number into the AssemblyInfo file using Nant - nant

I have done a lot of googling but cant seem to find an exact solution to get the TeamCity build number into my AssemblyInfo files. Would appreciate a full solution for my requirements...
1 Get the build number into a Nant variable. I believe that this code will accomplish this..
PropertyGroup
Version$(BUILD_NUMBER)/Version
/PropertyGroup
(repoduced as best as possible in SO).
2 Now I need a way to update the revision component of my version numbers so I get something like 1.0.0.[build number].
3 Ideally I need the whole thing in a re-usable Nant target so that I can just call it passing in the path to the assembly info file that i want to update.
I would respectfully request that if you can help me that a full solution is posted here with explanation as opposed to links to other sites. Ive looked at a lot of online examples but cant seem to find one that fits what I need - therefore I request the knowledge of the omnipotent SO community!
Thanks in advance.

First of all, the code snippet in your question is MSBuild syntax, not NAnt. Assuming that NAnt is your build tool, there is a good explanation of how to update AssemblyInfo files with Cruise Control.NET here. That applies to TeamCity as well, just replace "CCNetLabel" with "build.number" and you will be fine.
To get a version number like 1.0.0.[build number], you can accomplish that in the TeamCity build configuration. On the first configuration page (General Settings). Change the "Build Number Format" from "{0}" to "1.0.0.{0}". See the online help for more options.

I know you asked for an NAnt reusable task, but this is too cool.
TeamCity has a new feature tailor-made for this purpose (AssemblyInfo Patcher).
You don't have to change anything in the (NAnt) build. Just add the "Additional Build Feature" for AssemblyInfo patcher in the Build Steps configuration for the build. You can also set the format for the version there.

Related

How to make a Github action pipeline to build, test (gtest), and document (doxygen?) C++

I'm wanting to create a pipeline on Github for a C++ project that will build, test, and document it. The project is supposed to be compiled with GNU Make, but for now, it can be done using CMake as I can change it later. I want it to run tests using google test and also automatically create documentation for it (I've used Doxygen in the past which nicely makes HTML formatted documentation from your comments).
I've tried to get this working and used a bunch of different yaml files I've found online, but I can't get it working exactly right. The best I've been able to do is get it to build and for the tests to run, but I can't get the automatic documentation to work. Doxygen is reliant on a Doxyfile to configure it, but I'm not sure of a simple way to configure it (stuff I've found online seems overly complicated for what I want). I'm open to using a different method for automatically generating documentation if there's one that would work better.

Multiple _PublishedWebsites Folders

I am using VS Code on Manjaro and have setup a solution with 2 projects, a webapp and a test project.
Each time I do a build it appears to generate a new _PublishedWebsites folder with NetCoreApp underneath it. I am surprised that nobody else seems to have encountered this issue. Can anyone tell me why this is happening and how to fix it?
Many thanks.
You should check your csproj file, particularly PublishDir element which is your specified location for publishing output files and change that if your like.
However, I think this is required behavior for .net core support in app harbor, find more details in the support webpage over here.

Specflow Autogenerated c# code using cake

I was wondering if there was any way Cake could build Visual Studio Solution and detect changes in feature files and generate the corresponding changes. If not Cake, can it be done using any other way other than Visual Studio? I have tried finding documents related to it but I cant find anything related to it.
If you want to generate the code behind files of the feature files during build time, you have 2 options.
Run specflow.exe generate all in the pre build event
Documentation: http://specflow.org/documentation/Tools/
Use the MSBuild integration
Documentation. http://specflow.org/documentation/Generate-Tests-from-MsBuild/
The recommend way is to use the MSBuild integration.
I have no experience with Cake, but perhaps you can integrate/use one of these options with it.

Sandcastle Distinguishes Between Debug and Release Builds?

I fired up Sandcastle Help File Builder today to generate documentation for my solution, which has around a dozen projects in it. Since I only want to generate documentation for, and run Sandcastle after, a Release build (which excludes all my test projects), I selected "Release" at the top of the window, just like in VS. Sandcastle appropriately looks for the gen'd XML files in my \bin\release subfolders for each project. However, it errors out when it cannot find DLL's for my test projects. It apparently sees those projects in the solution file, but doesn't realize I don't have builds for them in Release. I tried de-selecting them in the "API Filter" property, but this doesn't change anything.
How can I get Sandcastle to ignore those projects?
SHFB is nice, I've been using it recently. It turns out that there are a number of ways you can specify documentation sources. One way is by selecting the solution, as you seem to have done. You can also choose the project files for just the projects you are interested in documenting. You can even choose the resulting assemblies as sources.
Try changing the docu source from the solution to just the projects you are interested in. It doesn't quite answer your question, but it is a workaround, since you fairly likely have no need to document your test projects.

Bamboo Versioning

I have a situation where i need to maintain version information of my builds. By googling i found limited information. one way is to create a version file on source control and keep updating. other is to use the source control revision number. final one is to use bamboo build number. i haven't implemented anyone of this before. colud anyone point out the pros and cons of each method.
Thank you,
Reddy.
Please atleast tell me which method have u used to implement the same.
Thnq..
Visit http://confluence.atlassian.com/display/BAMBOO011/1.2.1+Using+Custom+Variables for more information about bamboo variables.
Remember to define a system property in your job configuration like this:
-DbambooBuildNumber=${bamboo.buildNumber} then you can use this property bambooBuildNumber in your maven or ant configuration file.
Good question. I've done this in kind of an ad-hoc manner before. I don't strongly advocate the following approach, but I'll list it anyway for comparison with the (I hope) better approaches that others will soon be posting.
In order to maintain the version information in a medium sized Java codebase, I created a simple class to hold the major, minor, and revision version numbers as static constants and produce a formatted version string. I then created a perl script to check the class out of version control, replace the version components with those specified as arguments to the script, and check it back in.
The script does most of the work, so the process of updating the version is fairly simple and quick. I had to implement this quickly, so there are probably better ways of doing it. I just didn't have time, or motivation, to research better alternatives.
I'm not entirely sure what your question is but I'm assuming you want build numbers? When you build your project with Ant you can use the BuildNumber task to keep track of build numbers.
you can use ${bamboo.buildNumber} in ant
look at the following thread
http://forums.atlassian.com/thread.jspa?messageID=257319944
The following link is a pretty good article. If you can get all the plugins working with the version of Bamboo you're on it should be fine.
Release Management with Atlassian Bamboo (outdated)
Release Management with Atlassian Bamboo via the Internet Archive