Austin Agile DevOps

DevOps in the Cloud
posts - 70 , comments - 7 , trackbacks - 0

Friday, December 14, 2012

Entity Framework for Visual Studio 2012 Update 1: Reverse Engineer Bug and System.Data.Entity.Infrastructure

I had a couple of minor delays setting up Entity Framework in Visual Studio 2012 Update 1.

  1. Reverse engineering the database failed with the following error: “A processor named 'T4VSHost' could not be found for the directive named 'CleanupBehavior'. The transformation will not be run.”

The work around for C# projects is to:

Open the File
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.CS.ttinclude (for C#)

And Remove the First Line:
<#@ CleanupBehavior Processor="T4VSHost" CleanupAfterProcessingTemplate="true" #>

See this bug in Connect  for more details.

     2.  Finding the reference for “using System.Data.Entity.Infrastructure.”  The procedure to add this reference is:

In Visual Studio 2012, select menu item "Tools"-> Library Package Manager -->  Package Manger Console 
and typing there:
PM> install-package EntityFramework

See this forum post for more details.

Posted On Friday, December 14, 2012 3:17 PM | Comments (0) |

Simple TFS 2012 API Methods: List Projects in a Collection and Import WIT Definitions

I found a lot of code to do these things, but really appreciated a more concise and simple approach. For example, this can be run as a unit test.

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Xml;
using System.Collections.Generic;
using System.Linq;
using Microsoft.TeamFoundation.Server;
using Microsoft.TeamFoundation.Common;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
using Microsoft.TeamFoundation.Framework.Client;
using Microsoft.TeamFoundation.Framework.Common;
        public void ImportProcessTemplateWitDefinitionsToCollection()
            string wsPath = @"{your path}\WorkItem Tracking\TypeDefinitions\";
            List<string> wits = new List<string>();

            TfsTeamProjectCollection tpc = 
                new TfsTeamProjectCollection(new Uri("{your collection url}"))
            var wis = new WorkItemStore(tpc);
            var projects = (from Project p in wis.Projects select p.Name).ToList();

            foreach (var targetTfsProjectName in projects)
                foreach (string wit in wits)
                    XmlDocument WitDefFile = new XmlDocument();
                    WitDefFile.Load(wsPath + wit);
                    string WitDef = WitDefFile.InnerXml;

Posted On Friday, December 14, 2012 9:58 AM | Comments (0) |

Powered by: