Problem with output to different

Oct 4, 2009 at 12:59 PM

I've been using an old version of the toolkit, before and everything is great.   But I decided to tidy things up and organize the output into separate project.  It basically takes an EDMX file and creates a Provider and Service layer (which I then use in MVC).  But, I've hit a wall, probably something silly.  When I set the output project to something other than the default it give me the exception below.  Here's the snippet of code that causes the problem, line 2 is the issue:

    var template = new Service{TableName = tb, NameSpace = ProjectName};
    template.Output.Project = @"../../" + ProjectName +"Service/" + ProjectName + "Service.csproj";
    template.Output.File = @"Service/"+ TableName + "Service.cs";


Error    1    An Exception was thrown while running the transformation code. The process cannot continue.  The following Exception was thrown:
System.NotImplementedException: The method or operation is not implemented.
   at EnvDTE.Project.get_FullName()
   at T4Toolbox.DteProcessor.<>c__DisplayClass14.<Validate>b__12(Project p)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at T4Toolbox.DteProcessor.Validate(IEnumerable`1 outputFiles, IEnumerable`1 projects)
   at T4Toolbox.DteProcessor.UpdateFiles(ICollection`1 outputFiles)
   at T4Toolbox.OutputManager.UpdateFiles()
   at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
   at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
   at T4Toolbox.TransformationContext.OnTransformationEnded(TextTransformation transformation)
   at Microsoft.VisualStudio.TextTemplating1C33B63C67ABC9CF8413D819DDF8BACB.GeneratedTextTransformation.Dispose(Boolean disposing) in l:\Test\WebLayers\WebLayersDAL\T4Scripts\ 18
   at Microsoft.VisualStudio.TextTemplating.TextTransformation.Dispose()
   at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(String fullClassName, String baseClassName, String[] importedNamespaces, String[] references, String source, String inputFile, Boolean debug, SupportedLanguages language, IDictionary`2 languageOptions, IFormatProvider format, ITextTemplatingEngineHost host, Boolean cacheAssemblies, String& result)        1    1 


Any suggestions?  Thanks!

Oct 4, 2009 at 3:51 PM

We have had problems of this type before. Different types of projects have different implementations of Visual Studio automatino model. I remember running into to a problem specifically with Project.FullName.

Which version of the T4 Toolbox you are using? What is the type of target project you are trying to add files to?

Oct 4, 2009 at 6:18 PM

I encountered into this annoying trouble too.
My problem was "Unloaded Projects" in solution.
If I remove or load these projects this error gone.
The worst: it depends on projects order, so sometimes
it is ok for unload a project. 

Oct 4, 2009 at 9:22 PM

I tried both (and 9.9 briefly to see if it made any difference).  I'm targeting Class Library projects.  My project structure is:

  • Web App (ASP.Net MVC)
  • Provider (Class Library project)
  • Service  (Class Library project)
  • Tests  (MSUnit project)
  • T4 Project ( empty project with T4 scripts)

When I target the first project (Provider or Service) everything works fine, but if I try to target a second project from the same script run, it gives the exception above.  I've tried swapping the order, but it still works out that the first project fills with generate code, but once it tries to generate anything in the second project it bombs.

My only solution for the moment, is to have separate T4 scripts for each project target, but I'd like to merge them into one.

Oct 5, 2009 at 11:44 AM

In other words you encounter the problem when you target two C# Class Library projects from a single script, correct?


Oct 5, 2009 at 11:54 AM

Yes, that's correct.





Oct 9, 2009 at 11:44 AM


This scenario definitely works, just verified it. The problem is caused by a project in your solution that doesn't support FullName property. T4 Toolbox is not prepared to handle it at this time. As a workaround, you can remove this project from the solution. I'll write this up as a bug.


Oct 9, 2009 at 12:18 PM

I had a database project in the solution.  Once I took it out, then T4 Toolkit worked great.