How to get the build creator - build

I would like to get in a build activity the build creator.
Is it possible to get them from the CodeActivityContext?
How can i do this?

You can get IBuildDetail object for build from context extensions (or pass it to activity as argument)
context.GetExtension<IBuildDetail>()
Properties from there will provide what you need
http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build.client.ibuilddetail.aspx
Public property RequestedBy Gets the user who requested this build.
Public property RequestedFor Gets the user for whom this build was requested.

Related

TFS 2015 builds : Is it possible to use Variables in Repository mappings?

When creating a vNext build on TFS 2015 you can define variables, which are then used in build steps, and can also be used as environment variables in scripts the build runs.
The build I am working on runs scripts that pulls files from mapped locations, so it would be great if I could define a variable and use it in a mapping so that for example, if I update a reference in the project the build is building, I can simply update the variable with the new location and have the repository mappings and scripts all pull correctly from the new location without having to make the change in multiple places.
I have tried doing this by setting up the variable and mapping as follows,
But this generates an error when you try to save the build complaining that there are two '$' characters in the mapping. Is there way to do this or is this not currently possible?
This has been causing me havok for quite a while as well.
For starters, there is a uservoice request for this feature. You can add your votes and input here to get Microsoft to allow this feature: https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/14131002-allow-variables-in-repository-variables-and-trigg
Second, we've developed a workaround that gets us most of the way there. It's not perfect, but it might be useful to you if you're comfortable with the tradeoffs or can work around the deficiencies.
Start by turning off the "Label Sources" option of the build and mapping the Server Path field to you base build. You'll want to add a custom variable to the Build Definition to tell the build instance what TFS location to pull from. For example, we have a base project and then multiple branches from the project, so our source is structured like this
$\Team Project\Project1
$\Team Project\Project1Branch1
$\Team Project\Project1Branch2
$\Team Project\Project1Branch3
and we create a variable named "Branch" that we can set to "Branch1", "Branch2", and so forth.
When we want to build the base project, we leave the Branch variable blank when launching the build. For branch builds, we set it to the name of the branch we want to build.
Then our build steps look like this
Remap Workspace Folder to Branch Folder
Get Files for Specified Branch - We have to do this manually after
remapping our workspace
Compile the Source in the Specified Branch
Publish Build Artifacts from the Specified Branch
Label the Code of the Specified Branch Manually
The Remap task runs the command
tf workfold "$/Team Project/Project1$(Branch)" "$(build.sourcesDirectory)\$(Build.DefinitionName)$(Branch)"
The Manual Get task runs the following command
get /recursive /noprompt "$/Team Project/Project1$(Branch)"
The build uses the Branch variable to point to the correct location of the solution file for the specified branch
$(build.sourcesDirectory)\$(Build.DefinitionName)$(Branch)\SolutionFile.sln
The Publish Artifacts task uses the Branch variable in both the Contents field and the Path field
Example in Contents
**\$(Build.DefinitionName)$(Branch)\bin
The Label Code task uses the following command
tf label "$(build.buildNumber)" "$/Team Project/Project1$(Branch)" /recursive
The downside of this setup is that you don't capture Associated Changes and Work Items to your subsidiary branches as the Server Path field is always set to the main location. This may not be an issue if you always merge from your branches to your main location prior to launching a build meant to go to production. What you can do to compensate for this really depends on your use case.
With some tweaking, you could use this same format to specify full paths as well if you needed to.
It's impossible. Just as the error message mentioned: there are two '$' characters in the mapping. Which means your application's path shouldn't vary from build to build.
Mappings on the Repository page are used to specify source control
folder which contains projects that need to be built in the build
definition. You can set it via clicking the Ellipsis (...) button,
however, you can't include variables in the mapping path.
There is a similar question: Variables in TFS Mappings on Visual Studio Online Team Builds

Custom control published property does not exist

I have a custom control to which I am trying to add a property which can be set in the Object Inspector. According to this documentation, I need to place the property under the __published section of my header file.
__published:
__property bool ShowErrorIcon = { read=FShowErrorIcon,write=FShowErrorIcon };
I set up the property to read and write to the private bool FShowErrorIcon
private:
bool FShowErrorIcon;
However, when I launch the form that contains one of these controls I get the following error:
"Error reading RgnSearchBar.ShowErrorIcon: Property ShowErrorIcon does not exist."
This is confusing me, because the property is clearly visible in the ObjectInspector when the control is selected. What step am I missing here?
You have an older version of the component binaries on your HDD. The version of the component that is loaded in the IDE is newer then the version that is getting linked into your executable. Somewhere, an older version is on the search path before the newer version, so the compiler/linker is linking the old version. You need to find and remove that older version.

Final Builder action to change exe properties

Is there a way to modify the properties of a file (exe in my case) with a final builder action after the file has been created?
Specifically, I'd like to change:
File description
Product name
Product version
And remove:
File version
Original filename
The normal approach with finalbuild is to set these values as part of the compile EXE action. For instance, when your FinalBuilder process includes a Compiler action you should be able to configure these values.
However if your doing this in a post exe built phase, Try the Wind32 Version Info Updater Action.

Change Eclipse Dynamic Variable to build a single c++ class

I would like to change the dynamic variable ${selected_resource_loc} such that I get rid of the extension (and can add another one).
The purpose is to build the current selected file, but therefore I don't need the .cc-file in my command but the .o-file with the same name.
Detailed description:
I have a customized make command (lets say make) and would like to execute make selectedFileName.o, where the current selected file in eclipse is selectedFileName.cc. (I put the command as build command in project properties -> C/C++ Build.) With variable ${selected_resource_loc} in behaviour tab I get make selectedFileName.cc.
I solved my problem by writing a skript where I modify the ${selected_resource_loc} and included it via external tools in eclipse.

How to programmatically list all properties defined while executing MSBuild?

I'm looking for a way to access all the Build properties defined while executing MSBuild. I have a configuration file. I want to modify the Properties in the configuration file and copy it to a new location. Is there a way to do it?
If you run the build with /verbosity:detailed or /verbosity:diagnostic you will get very detailed output of all the properties that was used during your build process. However I suspect you want to change a config type file after/before you copy the builded files to another location? In that case there is several mechanismes to do that, what we have found to work pretty good, is the MSBuildCommunity tasks that can be found here on code plex
If you would like to see some samples of this I would be glad to post them