Updating template from child build configuration in TeamCity - teamcity

So imagine I have a template that is used 5 times(in 5 different environments). I've then realised I need to make changes to this template. The way I would like to:
Make a change to one of the child build configurations in one of the environments which is based off of the template.
Test this change to see if it works as intended.
Then overwrite the template with the child had the changes made onto it.
Been searching for a way to do this but haven't found one. I could also manually replicate the changes on the template that was done on the child, but I would prefer not to do this(since mistakes could be made in copying and it would take longer than pressing a few buttons).

Related

TeamCity: revert overriden steps

Situation: we have a set of build configurations based on the same build template. So, all the configs are marked as "based on MySuperTemplate" and all build steps are marked as (inherited). So far so good.
Eventually I introduced a change in a step of a particular build config, not in the template itself. After figuring this out, I applied the change to the template, however corresponding step of that particular build config is still marked as (inherited, overridden).
Question: how to undo that "override state" back to "just inherited" so the step will accept all the changes from the template origin again?
P.S. TeamCity version is 2021.2.3 (build 99711) if it matters...
No idea why I didn't notice it before:
Open the build configuration, go to the grid of steps
At a grid row with "overridden" step, find "Edit" hotlink accompanied with a small combo-button aside (right-side of the row)
Open a drop-down for this combo-button and click "Reset" option (it appears for overridden steps only, regular ones are provided with "copy" and "disable" choices)
As simple as that. Now the step is reverted back to the template-defined content.

Which is the most advantageous strategy for creating a tweaked Visual Studio Project Template?

I'm appealing to the wisdom of the crowd here, trying, in this case, to avoid the code less traveled.
I created a Visual Studio project template, but now find there are a couple of things I can/should add to it, and one or two things I need to modify.
What is the "received" way, or "preferred method" of doing this: modifying the existing template directly, or opening a project using the existing template, and then saving that template-based project, after modification, as a template, perhaps overwriting the previous one (if that's even possible/allowed by the VS "ecosystem")?
I copied the extracted contents of the zipped template from C:\Users\clayshan\Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual C#\folder_name\template_name.zip to another location.
Does it make the most sense to open that project, modify, and save as a template, or to simply create a new project from the existing template, and then save that "new and improved" project as a template?
RUNNING COMMENTARY
When I open the extracted template as a project, I get a warning, "Load of property 'RootNamespace' failed. The string for the root namespace must be a valid identifier." I don't know if this is to be expected in this scenario, or if I should be slightly scared.
Another funky (as in "gives me the fantods", not as in the Troglodyte song) thing is that a template won't compile, as it's got those placeholder namespace names.
I edited the existing, zipped, copied it over to the village where the VS templates live and...now when I go to start a new project, there are two identical-looking templates there: the old, and the new. The question is, which is which? It's kind of annoying having to open them to see...
The final (hopefully) weird thing about the process is that, even though I added a "Site ULR" property to the template, on creating a new project from the template, that assignment reverts to blank.

Mark a large number of files as Build Action "None" in Visual Studio

I have a folder containing 12000 images. When I add them to my project they get marked as Resources, but I want to set their Build Action to None. If I select them all and go to the Properties tab and set None, VS starts working and engulfes itself.
Is there another way to do that? Or a way to set the default Build Action for newly added files to None?
Thank you!
Make a backup of your project file (e.g. by committing it to a branch in source control locally) before making manual changes to the file.
Right click the project node in Solution Explorer and click Unload Project.
Right click the project node in Solution Explorer and click Edit yourproject.csproj.
Replace all instances of
<Resource Include="Resources\
with
<None Include="Resources\
Save and close the project file.
Right click the project node in Solution Explorer and click Reload Project.
Optionally you could also remove all instances of these lines and use the following single line instead. You'll definitely want to mark your place in source control so you could undo the change if it doesn't work out like you expect.
<None Include="Resources\**\*.jpg"/>
12,000 files is a good two orders of magnitude beyond what you can reasonably expect to be performant during a build. Just checking if files need to copied can easily take 5 minutes on a spindle drive. Still uncomfortable on a solid-state drive.
You'll need a drastically different approach to solve this. Key approach is that you don't wait for it so cannot get annoyed at the delay. Like spinning this off into a separate project that builds a resource DLL, not included in the solution. Preferably done on another machine, build servers are good for that. Or a completely different approach to packing the files, like sticking them in a ZIP archive. A "wad" in gaming speak of old. Or taking your program to the files instead of the other way around, keeping them stored on disk and telling your code where to find them with a configuration setting.

How to exclude image files in Xcode project bundle, conditionally for Release version?

I added .png images to the Xcode project for conditional use like making screenshots of a view
However, since this is not needed for the Release version of the app, I would like to find a way to exclude them using some kind of settings for Target. I expect there can be a solution like using #if DEBUG macro for Debug compilation, which can work for lines of source code. But, in case of files included in project bundle, I am having trouble finding the answers.
In Xcode 3, there's a view above the editor that lists the files in the project. There's a checkbox on the right side of that view for each file, and you can uncheck the box to remove the file from the current target.
In Xcode 4, show the Project Navigator on the left side of the window, and show the File Inspector on the right side, in the Utilities area. When you select a file, you'll see a Target Membership area with a list of targets and checkboxes. If you want to exclude the file from a particular target, uncheck the box next to that target. Here's a picture:
This is a bit different from excluding files from only some builds of a single target. Still, I think it's the simplest mechanism to use for the situation that you describe. Simply duplicate your existing target so that you have a copy that you can use for making screenshots. Remove the extra files from your production target but leave them in the screenshot target, as described above.
A target's inputs are the same for all builds, so there's no checkbox that will do it for you.
All that really happens though is that image files like .png or whatever get added to the copy bundle resources phase. You can remove them from that phase and instead create a custom script build phase using a shell script.
It will default to printing out all the environment variables set by xcode, from there you should be able to write a script which only performs the copy when say ${BUILD_STYLE} is 'Debug'.
You probably want ${BUILD_STYLE}, ${CONTENTS_FOLDER_PATH} and ${INPUT_FILE_PATH} for starters.

Disabling ReSharper reordering of code during code reformatting?

I use the code reformatting tool in ReSharper to get some standard format on my code, but I don't like that it moves methods around.
For instance if I rename a method, and then reformat, the method is moved. This makes merging changes between branches a nightmare.
Is there any setting I have missed that will disable this particular part of the reformatting?
Set up a custom R# profile
Click Resharper > Tools > Code Cleanup
Then choose "Edit profiles", add a new profile, deselect what you don't want and save it.
Run this profile in the future
You should modify the Type Members Layout xml for that. In that file you have several patterns which you can reorder or delete to get the behaviour you want. All the changes you make in that file will be reflected in the following file:
C:\Documents and Settings\user\Program Data\JetBrains\ReSharper\v4.5\vs8.0\UserSettings.xml
so you can make a backup before playing with it or add it to your source code tree.

Resources