Visual Studio / TFS 2013 Upgrade

Nov 2, 2013 at 8:39 PM
Hello Everyone,

Just to let you know that I've pulled the source for TFSVersioning and using the solution in the Main directory and updated the Microsoft.TeamFoundation.* references to point at TFS / VS 2013.

I had to implement one missing property in the TfsBuild.Versioning.Activities.Tests.Stubs project and then it all worked as before.

I'm using it against Team Foundation Service Hosted Build Servers no problem at all.

If someone could guide me uploading the source I'd be happy to do that.

John
Nov 18, 2013 at 10:52 PM
Edited Nov 20, 2013 at 11:08 PM
Hi John,

I'm afraid the upgrade gets a little more complicated than just upgrading the Microsoft.TeamFoundation.* references...

Here is my setup: I'm using a clean installation of Visual Studio 2013, and I have uploaded the source code of TfsVersioning in Visual Studio Online (formerly known as Team Foundation Service). Now i want to build TfsVersioning via Visual Studio Online.
After changing Microsoft.TeamFoundation.* references to version 12.0, the project compiles fine locally. But if I try to define a build definition for this project to build it via Visual Studio Online, using the DefaultTemplate11.1.xaml, the build fails.

I'm still investigating a solution but i believe the failure comes from the MSBuild activity (there are 2) in the DefaultTemplate11.1.xaml, still using MSBuild 11.0 instead of using 12.0.

I see 2 ways to fix it also i have only tried the first one:
  1. Change the template of the build definition to use the new TfvcTemplate12.xaml, and everything now compiles on the build server.
  2. Change the ToolVersion property of the MSBuild activities in DefaultTemplate11.1.xaml to "12.0" (didnt try yet).
This raise 2 new questions.
  1. Can the new compiled TfsBuild.Versioning.Activities be used as the former one in VersioningBuildTemplate20.xaml
  2. Should the TfsVersioning use the new template TfvcTemplate12.xaml intead of being derived from DefaultTemplate11.1xaml . This new template looks much simpler than the former one, but i don't see where the VersionAssembly activity should be inserted...
Avi
Nov 20, 2013 at 10:56 PM
Edited Nov 20, 2013 at 11:07 PM
Hi,

Small update.
I finally went with the following changes:
  1. Edit solution with VS 2013 and change Microsoft.TeamFoundation.* to version 12.0.0.0
  2. Implement missing property ContainerId in BuildDetailStub (comes with the new IBuildDetail but is not use in the code anyway). Using a mocking framework like NSubstitute would have made this change unnecessary... just saying...
  3. Create a new DefaultTemplate12.1.xaml from DefaultTemplate.11.1.xaml and edit its definition to force the 2 MSBuild activities to use attribute ToolVersion set to "12.0"
  4. Create a new VersioningBuildTemplate21.xaml from VersioningBuildTemplate20.xaml where you repeat the same change for the 2 MSBuild activities.
  5. Create a build definition for the TfsVersioning solution that uses DefaultTemplate12.1.xaml, everything should compile fine including unit tests on TFS2013 and you can now use the new produced TfsBuild.Versioning.dll. Note that using the new TfvcTemplate12.xaml compiles the solution but fails some of the unit tests. so i didn't use it.
When you want to version a new project, use VersioningBuildTemplate21.xaml to create the build definition and make the build controller use the new TfsBuild.Versioning.dll

With VS2013 you can fully edit the new template, if you need to add your own custom activities. No more red warning when viewing the xaml.

Last, I'm planning to do the exact same thing for Nugetter...

Cheers

Avi
May 6 at 4:28 PM
thaiat wrote:
Hi,

Small update.
I finally went with the following changes:
  1. Edit solution with VS 2013 and change Microsoft.TeamFoundation.* to version 12.0.0.0
  2. Implement missing property ContainerId in BuildDetailStub (comes with the new IBuildDetail but is not use in the code anyway). Using a mocking framework like NSubstitute would have made this change unnecessary... just saying...
  3. Create a new DefaultTemplate12.1.xaml from DefaultTemplate.11.1.xaml and edit its definition to force the 2 MSBuild activities to use attribute ToolVersion set to "12.0"
  4. Create a new VersioningBuildTemplate21.xaml from VersioningBuildTemplate20.xaml where you repeat the same change for the 2 MSBuild activities.
  5. Create a build definition for the TfsVersioning solution that uses DefaultTemplate12.1.xaml, everything should compile fine including unit tests on TFS2013 and you can now use the new produced TfsBuild.Versioning.dll. Note that using the new TfvcTemplate12.xaml compiles the solution but fails some of the unit tests. so i didn't use it.
When you want to version a new project, use VersioningBuildTemplate21.xaml to create the build definition and make the build controller use the new TfsBuild.Versioning.dll

With VS2013 you can fully edit the new template, if you need to add your own custom activities. No more red warning when viewing the xaml.

Last, I'm planning to do the exact same thing for Nugetter...

Cheers

Avi
I followed these steps and was able to get TFS Versioning working on my TFS build server. It was really not that hard to do. So, I'm wondering when can we expect an official update?
May 21 at 8:04 PM
I followed these steps, too, but I must have made a mistake. Referencing the Harder Installation but More Instructive instructions on tfsversioning.codeplex.com (http://tfsversioning.codeplex.com), step 5b differed in the standard build template in TFS 2013, I believe. I see Run on agent and the first step is Initialize environment. When attempting to drag the newly-compiled for TFS 2013 VersionAssemblyInfoFiles component from the toolbar, all I get is the forbidden icon (circle with line through it).

Any help or suggestions are greatly appreciated!
May 22 at 12:43 PM
skurt000 wrote:
I followed these steps, too, but I must have made a mistake. Referencing the Harder Installation but More Instructive instructions on tfsversioning.codeplex.com (http://tfsversioning.codeplex.com), step 5b differed in the standard build template in TFS 2013, I believe. I see Run on agent and the first step is Initialize environment. When attempting to drag the newly-compiled for TFS 2013 VersionAssemblyInfoFiles component from the toolbar, all I get is the forbidden icon (circle with line through it).

Any help or suggestions are greatly appreciated!
Turns out I tried to add the step to an template by just opening the file rather than having a Workflow project containing the template. After creating a proper workflow project, this is now working: http://msdn.microsoft.com/en-us/library/dd647551.aspx

What I'm trying to figure out now is how to set Workspace and BuildSettings properties on VersionAssemblyInfoFiles in the workflow as they have an exclamation mark next to them. Do I even need them?
May 23 at 1:47 PM
I actually did not bother editing the TFS versioning template (step 5 above). I used the one that came with TFS versioning and that worked fine. It is not based on the newer TFS default template, but that hasn't been an issue for me yet.
May 23 at 1:51 PM
Hi Ian,

Thanks for getting back to me. I'll open the TFS versioning template and check what it may pass, but since that's also geared towards TFS 2012, I wonder what it does for Workspace and BuildSettings. Both properties have got to be around somewhere in TFS 2013, but I'm simply missing how to get a handle to them. My inability to find information about this through searching sadly has led to little knowledge gain.

Simon
May 23 at 2:00 PM
Edited May 23 at 2:02 PM
skurt000 wrote:
Hi Ian,

Thanks for getting back to me. I'll open the TFS versioning template and check what it may pass, but since that's also geared towards TFS 2012, I wonder what it does for Workspace and BuildSettings. Both properties have got to be around somewhere in TFS 2013, but I'm simply missing how to get a handle to them. My inability to find information about this through searching sadly has led to little knowledge gain.

Simon
I did mess a bit with trying to get it working, but ran into the same issues. It turns out that TFS 2013's default template is much simplified. It does away with the environment setup and has Workspace set through some other magic. I did manage to get some of it partially working.

This sums it up nicely:
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/e8ab3bf2-a6ce-4823-85e7-062ad5ca34df/tfs-2013-workspace


If you do manage to get it all set up, would you mind posting the resulting XAML?
May 29 at 6:12 PM
I found a new issue with the TFS 2013 upgrade.


I am running TFS 2013 on our build server and set up a build for one of our recent projects that uses Fody.

This happens only when I configure the build with the TFS versioning (which matches the old TFS 2012 default template):


I suspect that this is because TFS overrides the $(TargetDir) macro.

Here is a snippet of the TFS build log when configured using the VersioningBuildTemplate that comes with TFS Versioning . You can see that it does restore the nuget packages that I need, however it does not do the actual Fody stuff.
 Restoring NuGet packages...
  To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
  Installing 'Commander.Fody 0.8.1.2'.
  Successfully installed 'Commander.Fody 0.8.1.2'.
  Installing 'Costura.Fody 1.3.1.0'.
  Successfully installed 'Costura.Fody 1.3.1.0'.
  Installing 'FluentValidation 5.1.0.0'.
  Successfully installed 'FluentValidation 5.1.0.0'.
  Installing 'Fody 1.23.2'.
  Installing 'Newtonsoft.Json 6.0.3'.
  Successfully installed 'Fody 1.23.2'.
  Installing 'PropertyChanged.Fody 1.48.2.0'.
  Successfully installed 'Newtonsoft.Json 6.0.3'.
  Installing 'reactiveui-core 5.5.1'.
  Successfully installed 'reactiveui-core 5.5.1'.
  Installing 'reactiveui-platforms 5.5.1'.
  Successfully installed 'PropertyChanged.Fody 1.48.2.0'.
  Installing 'Rx-Core 2.2.4'.
  Successfully installed 'Rx-Core 2.2.4'.
  Installing 'Rx-Interfaces 2.2.4'.
  Successfully installed 'Rx-Interfaces 2.2.4'.
  Installing 'Rx-Linq 2.2.4'.
  Successfully installed 'Rx-Linq 2.2.4'.
  Installing 'Rx-Main 2.2.4'.
  Successfully installed 'Rx-Main 2.2.4'.
  Installing 'Rx-PlatformServices 2.2.4'.
  Successfully installed 'reactiveui-platforms 5.5.1'.
  Installing 'Rx-XAML 2.1.30214.0'.
  Successfully installed 'Rx-XAML 2.1.30214.0'.
  Installing 'Validar.Fody 1.4.4.0'.
  Successfully installed 'Validar.Fody 1.4.4.0'.
  Successfully installed 'Rx-PlatformServices 2.2.4'.

  ........

  ProjectName -> C:\...PathToBinaries\Binary.exe
  Done Building Project   ...

  Build succeeded.
    0 Warning(s)
    0 Error(s)
At no point do I see that it executed Fody.

On the developer's machine, I see
Build stuff

  ........

Fody (version 1.23.2.0) Executing
    Finished Fody 1848ms.
ProjectName -> C:\...PathToBinaries\Binary.exe
When I switch the build on TFS 2013's DefaultTemplate, in the build log I see,
  WinFodyTarget:
    Fody (version 1.23.2.0) Executing
      Finished Fody 7907ms

  ........


  ProjectName -> C:\...PathToBinaries\Binary.exe
  Done Building Project   ...

  Build succeeded.
    0 Warning(s)
    0 Error(s)
This is a big reason for me to try again an make the new TFS 2013 version of DefaultTemplate work with TFS Versioning.


The good news is: I have it working! I am going to clean up my XAML file (which uses the TFS 2013 DefaultTemplate). I will post back again, when I have that done.
May 29 at 6:46 PM
image

Important info

  • Get BuildDetail. Scope to Initialize Variables. Used to generate Workspace name.
  • Get BuildAgent. Scope to Initialize Variables. Used to generate Workspace name.
  • Get the Build Directory. Scope to Run on Agent. I think TFS Versioning needs this somewhere else.
  • Assign WorkspaceName. This is the default generated workspace name by TFS when it creates a workspace. I actually grabbed this string format from the TFS 2012 default template. Scope to Run on Agent.
String.Format("{0}_{1}_{2}", BuildDetail.BuildDefinition.Id, Microsoft.TeamFoundation.LinkingUtilities.DecodeUri(BuildAgent.Uri.AbsoluteUri).ToolSpecificId, BuildAgent.ServiceHost.Name)
  • Change the properties on Get sources from Team Foundation Version Control so that it's WorkspaceName is the one that you just assigned
  • Use WorkspaceName to GetWorkspace
    • Assign GetWorkspace call to Workspace. Scope to Run on Agent. This is used by TFS Versioning to do Check-in/Check-out.
  • Version assemblies

Notes

I have not tested all of the functionality of TFS Versioning with these changes. Though, it should work alright...theoretically. For example, I did not try to a build where I check-in the files after versioning the assemblies.
May 30 at 8:53 PM
If anyone can eventually make a VersioningBuildTemplate????.xaml file that works with VS 2013 Work Flow Designer and TFS Build 2013 that would help me out tremendously.

Thanks!!!!
Jun 18 at 3:35 PM
is there any one to help me!!!

i have project that the Build Action use Embedded Resource Dll in Bin folder and xaml file Build Action=page in other folder.
in TFS Build 2012 (workflow Msbuild ) i Build other project correctly but this one i allway see this error :

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "...Cmn". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [E:\Builds\17..me.Net\MyBuildDeffinition\Sources..me..me.csproj]

thanks
Aug 7 at 5:29 PM
Hi Ian,

Are you able to post your source code? The project and xaml by chance?