Error in T4 to SQL .NET

1

When trying to generate the sql code based on edmx you are experiencing this error

  

Severity Code Description Project File Line Suppression State   Error Running transformation: System.NullReferenceException: Object   reference not set to an instance of an object. at

     

Microsoft.Data.Entity.Design.DatabaseGeneration.MetadataWorkspaceExtensions.GetAllAssociationSets (ItemCollection   itemCollection) at

     

Microsoft.VisualStudio.TextTemplatingFED2D73CEED00C99E8A0A14FA9AE33EAFFDF3CAAFEE9E04D21CC913F1C5C88D960592C81A433C11663E61FD5459CF679CFD9B7275B72CA8BFB8D753DBB9FDDE3.GeneratedTextTransformationText ()   in C: \ Program Files (x86) \ Microsoft Visual Studio   14.0 \ Common Files \ DBGen \ SSDLToSQL10.tt: line 104 Miscellaneous Files C: \ Program Files \ Common7 \ IDE \ Extensions \ Microsoft \ Entity Framework   Files (x86) \ Microsoft Visual Studio   14.0 \ Common \ IDE \ Extensions \ Microsoft \ Entity Framework Tools \ DBGen \ SSDLToSQL10.tt 104

    
asked by anonymous 10.04.2017 / 18:52

1 answer

0

Line 104 of file C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\SSDLToSQL10.tt contains:

foreach (AssociationSet associationSet in ExistingStore.GetAllAssociationSets())

It means that T4 is not finding its associations for some reason. Two hypotheses:

  • Your associations are not properly configured;
  • The database is wrong with the connection string .
  • 18.04.2017 / 19:03