What constitutes a workspace mapping when creating a new build definition? - build

We've been using TFS 2015 for a few years. I've got TFS 2018 installed on a test server and am experimenting with it. I want to make a new build definition to a project I have in an TFVC repo, in TFS 2018. So, creating a new definition I have selected the source as TFVC. Next it asks for a Workspace mappings, which I'm not clear as to what that is in this case. It defaults to the team project in the TFS repo, in this case it's $/RodTest. However, I don't want to choose that, because there are several projects within the RodTest team project. Instead I want to only create a build definition for one project named FindNonAscii. So, I figured I could do one of two things:
$/RodTest/FindNonAscii
$/RodTest/FindNonAscii/FindNonAscii.sln
Which is the correct mapping I should use?

Mappings are recursive. Map the root folder and anything underneath will be downloaded.

Related

Specflow setup to Share Hooks and Step Definitions Across VS Projects

Currently working on a series of projects that are contained within one solution in VS2017. Each project is a specflow project, within one solution. I would like to setup the Hooks.cs file such that it's valid for any test within the entire solution, not just the project. I'd also like to make step definitions from one project available to the other projects as a base or utility step definition.
How would I go about structuring specflow to make this possible?
You can use steps and hooks from different assemblies.
You can add in the configuration a list of additional step assemblies like this:
<specFlow>
<stepAssemblies>
<stepAssembly assembly="MySharedBindings" />
</stepAssemblies>
</specFlow>
The documentation is here: https://specflow.org/documentation/Use-Bindings-from-External-Assemblies/
But there are some known problems with it:
IntelliSense and Syntax Highlighting has some problems (https://github.com/techtalk/SpecFlow/issues/838)
Hooks could be registered double (https://github.com/techtalk/SpecFlow/issues/1004)

TFS Build - get source code by label issues

I have an issue that I want to share with you and ask for advice.
Let's say I have a project in TFS with a source code folders and folder with deployment scripts. Folders structure:
-- TFS
---- PROJECT
--------DEPLOYMENTSCRIPTS
--------SOURCE
DeploymentScripts folder is a container for custom deployment scripts that are being executed by TFS Build process.
Source - is a folder with a source code where for each new release I create a label to use it later for deployment.
I have a build definition configured to takes files from both folders, so I expect that TFS will download the content of both folders each time I trigger a build:
And this perfectly works when TFS build takes the latest version: it takes everything, builds and deploys.
The issue appears once I configure what label to take:
TFS downloads only the content of Source folder ignoring DeploymentScripts. I suppose that this happens because we use labels only for Source folder and not in DeploymetScripts (the content of this folder is static, there are no any changes). I know, that if I make DeploymentScripts a sub-folder of Sources that will fix my issue, but I want to keep it separate (for example, if I later create a bunch of branch folders I don't want to copy deployment to each specific folder, I want to have as a one instance) and try to find a solution for this case.
Either apply your label at the root level, or start your build using a date or changeset number.
Another approach would be to use branching rather than labels, and set up your build to allow you to pass in the name of the branch to be built.
I no longer use labels, I can't think of a situation where they would be useful to me these days.
If I encountered a team doing this my first question would be why do they need to use Labels to accomplish whatever workflow they are after. This is an unusual practice, most teams just do a Get Latest, and use an appropriate branching strategy to achieve their desired workflow.
If you must use a Label one option is to include the DeploymentScripts in your Labels. You can do this without have to move the folder location in source control by editing your Label.

Changing Config based on Build Definition TFS 2012

I have one code base but multiple clients. Is there a way that I can use a build definition to build out to separate IIS folders and also change the config for each client as well rather than changing it in source and build them one by one.
I'd even be happy enough with having one build defination for each client that changes only what it needs to from the code in TFS.
Thanks!
You can create a Configuration like the current "Debug" configuration in Visual Studio which will be associated with your solution. You can then have any web applications create a Web.Config transformation for each of those configurations:
Web.Config
--Debug.Web.Config
--Customer1.Web.Config
--Customer2.Web.Config
--Customer3.Web.Config
--Customer4.Web.Config
You can then edit the Build Definition and instead of just building the default configuration for the solution during the build you can tell it to build all 5 configurations.
Figure: Add multiple configurations to your TF Build Definition
It does not matter if the item (i.e. "Customer1") is not in the drop down, as long as it matches Visual Studio it will work.
This will result in:
\\DropFolder\[BuildDefenition]\[BuildDefenition]_[BuildNumber]\[configuration]\*
So if you want to get Customer 1's instance you pull from:
...[BuildDefenition]_[BuildNumber]\Customer1\_PublishSites\*
You can find how to create configurations on MSDN: http://msdn.microsoft.com/en-us/library/kwybya3w.aspx

TortoiseSVN and Visual Studio Express 2010

I'm using TotoiseSVN client and Assembla backend in a VS 2010 express project. We have issues with VS folders (or filters) dropping and files sometimes not being added to the project. I notice when I commit the .vcxproj and .vcxproj.filters files are never checked by default even though they should be changing. So I manually check them and told others to as well when they commit.
This can lead to issues if team member A checks out, only changes some code, while team member B has the project checked out and added files to the project. If team member B then commits BEFORE team member A, team member A's project file doesn't have the new files team member B added so now his project overwrites team members B's project file he checked in and now the new added files aren't in the project.
How do we get around this besides having amazing coordination?
CMake is perfect for this.
In case you haven't come across CMake, it allows you to create your entire project's build files in a separate directory to your source files, outside of svn altogether.
A single CMakeLists.txt file in your repository's root would replace all your current .vcxproj and .filters files.
I suspect what may be happening here is that the developers aren't saving the project files when adding new files to them. VS2008 did this by default, but I think that in VS2010 they aren't saved until you explicitly do File -> Save All. As a result it means that the changes are not getting committed. Once your devs do get in the habit of saving the project files before committing then SVN will in 99% of the time handle all the merges for you. The remaining 1% of the time is when someone has done some more major restructuring of the project file or two people have made conflicting changes to the build settings. In these cases you'd have to resolve them by hand.
SVN will never overwrite one person's changes with another, it will always try to merge. So if you're running into this problem it suggests that one person is somehow rolling back someone else's changes, or they don't have the option in Visual Studio set to reload files when changed externally: Tools -> Options -> Documents -> Detect when file is changed outside the environment.
An effective way of dealing with this problem is to set up a simple build server, eg with Jenkins that kicks off a build periodically after there have been some checkins. If the build fails then the person who checked in gets a mail to tell them they broke the build. You can also have a monitor that shows the build status which makes broken builds more visible to the whole team and hopefully encourages everyone to keep the build fixed.

Flex builder and multiple and potentially duplicated projects in the same work space?

Is it possible have two projects with the same name in flex builder?
Here is the scenario
~/projects/myprojectdev/ProjectName
~/projects/myprojectstable/ProjectName
myprojectdev
and
myprojectstable
are more or less the same tree structure and duplicates of the same codebase.
I am using git to manage them as separate repositories. I can do some stuff in the myprojectdev folder and then occasionally merge changes over to the myprojectstable folder when I am satisfied. But I want to keep code from myprojectstable in my working space in flex builder to be able to launch it and occasionally compare the code between dev and stable. I may also want to open different versions of the same project codebase and compare them in the working environment. The problem is that in both folders the "ProjectName" is the same. And so I can't import both into my Flex Builder workspace. I get the warning
A project with the same name already
exists in your workspace. Rename or
delete the existing project.
But I don't want to rename the project or mess with its folder structure. What do I do? Do I have to keep these in different folders? e.g.
~/projects/myprojectdev/ProjectNameDev
~/projects/myprojectstable/ProjectNameStable
You can rename a project (in eclipse/flex builder) without actually renaming the folder it is in. Edit the .project file in your ProjectNameDev and ProjectNameDev to give the projects different names. You might need to restart eclipse to get it to recognize the new name.