Over the past couple of years I’ve been a big advocate of continuous integration (automated builds) for SharePoint projects, and I’ve previously published some resources to help people get started with this. Specifically I have:
- A custom TFS build workflow – this is for use with TFS Build. It integrates with some PowerShell scripts I also supply, so that WSPs can be deployed automatically as part of the build. This is my “SharePoint CI starter pack”.
- Assembly versioning workflow activity – this is an optional custom workflow activity which will increment the version numbers of your assemblies as they are built in the right way for SharePoint. To simplify things I supply one workflow with this activity dropped in and configured, and one without.
Because Microsoft made some changes between TFS 2010 and TFS 2012, these things do not “just work” for TFS 2012 unfortunately. In fact, migrating a build workflow from TFS 2010 to TFS 2012 is a bit of a nightmare. But, I’ve now updated these with new releases for TFS 2012 so things should be a bit easier for if you work with this stuff.
A while back someone pinged me on Twitter asking for an update, and then some Microsoft folks got in touch to say “can we take ownership of your stuff, or could you update it?” and then last week I was in meetings about a TFS 2012 upgrade at my place of work (Content and Code), and since our larger SharePoint projects use this stuff I knew I had to bump this up the priority list :)
Where to find this stuff
I have two projects on Codeplex:
- SharePoint CI starter pack – http://sharepointci.codeplex.com
- TFS simple assembly versioning – http://tfssimpleversioning.codeplex.com
Both new releases are labelled “for TFS 2012”, and instructions can be found on each site. Briefly, you’ll need to download both if you want to perform versioning within your automated builds – if not, you can just use the CI starter pack, selecting the “no versioning” workflow in there.
Release notes
I’ve added release notes on Codeplex, but just to summarize here:-
- TFS simple assembly versioning
- This is a brand new workflow activity (with a new name - COB.CI.Workflow.AssemblyVersioning), due to the incompatibility between TFS 2010 and TFS 2012. As I say above, you can either drop this into your own (custom) TFS build workflow to have your assemblies versioning automatically, or use my workflows from my CI starter pack.
- This has been fairly well tested and is robust.
- SharePoint CI starter pack
- As before, this contains 2 workflows (with versioning/without versioning) and a set of PowerShell scripts which deploy WSPs etc. If you’re an existing user, you should add the 2 workflow XAML files to TFS, and then edit your existing build definition(s) to use one of these workflows.
- The TFS/PowerShell integration to deploy WSPs as part of the build has been well tested. However, at the time of writing I haven’t yet tested including automated tests (unit tests/UI tests) into the build – at this point, I just want to get something out there quickly to support any TFS upgrades of existing users.
Incompatibility issues around TFS 2010/TFS 2012
For completeness, I just wanted to show the errors you’ll see if you upgrade to TFS 2012 and are using my resources (i.e. attempting to use TFS 2010 workflow stuff in TFS 2012). In fact, I think you can expect to see errors if you open any build workflow after the upgrade – whether you use my stuff or not. You’ll see something like:
- System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.Team.Foundation.Build.Client, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies.
- System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.Team.Foundation.Build.Workflow, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies.
- Various other error messages all related to versioning.
Yes, it seems many TFS 2010 build workflows appear to have version numbers stamped into the XAML. I understand this is due to an unfortunate bug in VS 2010, specifically Team Explorer - this KB article has more details and a hotfix. However, chances are that (like mine) your workflows already have ended up with the version numbers in them by now. So, it’s certainly more painful than it should be.
You have two options to make your build workflow run in TFS 2012:
- Rebuild it from scratch in VS 2012/TFS 2012 – that’s what I did in the end with my CI starter pack workflows
- Attempt to clean the XAML:
- I tried this by hand several times and failed. The workflow failed to display in the designer, and there is precious little diagnostic information.
- Another option could be Jason Prickett’s “XAML cleaner” tool to remove the versioned namespaces in the file. I tried this, but for some reason it didn’t give me work on my workflows – you might have more luck.
The Jason Prickett post linked above also has other variations of error messages you might see.
Related error messages you might see if you use my resources:
Again for completeness, here are some other errors you might encounter if you’re using my resources but are “doing it wrong” according to TFS 2012. This is what you might see if you open a workflow with my (TFS 2010) assembly versioning activity after upgrading to TFS 2012/VS 2012:
You’ll need to fix the workflow to use the latest version of the activity if so.
And here’s what you’ll see if you try to drop my old (TFS 2010 version) assembly versioning activity into a TFS 2012 workflow:
Conclusion
Upgrading to TFS 2012 brings some pain if you do automated builds, whether in relation to SharePoint or not. For any SharePoint folks who use my resources, I’ve upgraded these to hopefully save you some pain. Please leave a comment on the Codeplex site if you hit any issues with them.
2 comments:
Chris
I am trying to setup the environment for continuos integration betweeen tfs 2012 and SP 2013.
I downloaded your files from here:
http://sharepointci.codeplex.com/releases
The first Issue I had is that after creating the build definition, I had this error:
tfs Could not load file or assembly 'Microsoft.VisualStudio.SharePoint.WorkflowExtensions
SO I installed WorkflowManagerTools on the server and now the workflow designer loads, I documented how to do it offline here if you dont mind: :)
http://levalencia.wordpress.com/2014/02/19/installing-sharepoint-2013-workflowmanager-and-workflowmanager-tools-in-an-offline-environment/
Now, the big question is:
As both build servers and sp 2013 are separate, what steps do I need to do in the build server so that the solution builds succesfully?
right now I have this error
TF215097: An error occurred while initializing a build for build definition \XXX Projects\XXX.SP.DMS:
Exception Message: Cannot create unknown type '{clr-namespace:COB.CI.Workflow;assembly=COB.CI.Workflow.AssemblyVersioning}UpdateAssemblyVersionNumber'. (type XamlObjectWriterException)
Thanks a lot for your help
@levalencia,
Luis, I think this is happening because my assembly is not in the GAC on the build server. Remember this needs to be the .NET 4.0 GAC.
Let me know if that doesn't fix it.
Thanks,
Chris.
Post a Comment