none
T4 template generation on build server fails RRS feed

  • Question

  • Hi all,

    We've recently changed our build server and the T4 MSBuild now seems to fail.

    I'm out of ideas, here is the log:

    (ExecuteTransformations target) ->  ...\Microsoft.TextTemplating.targets(396,5):

    error : An Exception was thrown while processing the template. 
    The following Exception was thrown:
    System.Runtime.Serialization.SerializationException: Type is not resolved for member 'Microsoft.VisualStudio.TextTemplating.AssemblyResolver,Microsoft.VisualStudio.TextTemplating.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
    at System.AppDomain.add_AssemblyResolve(ResolveEventHandler value)
    at Microsoft.VisualStudio.TextTemplating.Engine.CompileAndRunCode(String generatorCode, ITextTemplatingEngineHost host, TemplateProcessingSession session)
    at Microsoft.VisualStudio.TextTemplating.Engine.ProcessTemplateImplementation(TemplateProcessingSession session, String content, ITextTemplatingEngineHost host, String className, String classNamespace)
    Line=-1, Column=-1 There was a problem getting an AppDomain to run the transformation from the host. The process cannot continue.

     

    Any ideas ?

    Thanks

    Friday, September 16, 2011 4:50 AM

Answers

  • Thanks all we ended up fixing the issue by putting the t4 assemblies in the GAC. Not ideal but that worked...
    • Marked as answer by clement_911 Tuesday, September 20, 2011 9:32 AM
    Tuesday, September 20, 2011 9:32 AM

All replies

  • The Microsoft.VisualStudio.TextTemplating assembly is installed by Visual Studio. So there are a few options; I'm not sure if you've done one of these yet:

    Copy the assemblies from a machine with VS: http://msdn.microsoft.com/en-us/library/ee847423.aspx#buildserver

    Install the SDK on your machine: http://archive.msdn.microsoft.com/vsvmsdk

     


    Adi Unnithan | Software Design Engineer | SQL Server Developer Tools | Please mark the post as answered if it sufficiently answers your question
    Friday, September 16, 2011 6:33 PM
  • Yes, I forgot to mention that the Visual studio SDK (SP1) and the Visual Studio Visualization and Modeling SDK are already installed.
    Friday, September 16, 2011 9:27 PM
  • Hi,

    >>We've recently changed our build server and the T4 MSBuild now seems to fail.

    What did you changed? Could you show us more information about your changing actions?

    By the way, as Adi suggested, did you copy the mentioned files into the server or install the Visual Studio on your server?

    Regards,

    Yi


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, September 20, 2011 8:08 AM
    Moderator
  • Thanks all we ended up fixing the issue by putting the t4 assemblies in the GAC. Not ideal but that worked...
    • Marked as answer by clement_911 Tuesday, September 20, 2011 9:32 AM
    Tuesday, September 20, 2011 9:32 AM
  • Which specific assemblies did you move into the GAC?

    Thanks
    Johan

    Monday, October 31, 2011 5:19 PM
  • The following ones worked for us (gacutil -i ?):

    • Microsoft.VisualStudio.TextTemplating.10.0.dll
    • Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll
    • Microsoft.VisualStudio.TextTemplating.VSHost.10.0.dll

    Also had to make sure it was using the 4.0 gacutil from the SDK, which on our server was at:

    C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools\x64

    The .Net 4.0 SDK is at:
    http://www.microsoft.com/download/en/details.aspx?id=8279

    Johan

    • Edited by Johan Botha Monday, October 31, 2011 6:07 PM
    Monday, October 31, 2011 6:07 PM
  • I have also had the same problem:

     There was a problem getting an AppDomain to run the transformation from the host. The process cannot continue.

    , the solution was to uninstall CodeSmith for Visual Studio, it does not work with T4.


    C# Developer

    Friday, June 22, 2012 10:27 AM
  • Had a similar problem on my dev PC.

    In addition to the TextTemplating dll's I also had to add their dependencies to GAC make it compile.

    This included: 

    - Microsoft.CodeAnalysis.dll (v1.2.0.0)
    - System.Collections.Immutable.dll (v1.1.37) 
    - System.Reflection.Metadata.dll (v.1.2.0)
    - Microsoft.CodeAnalysis.CSharp.dll (v.1.2.0.0)


    • Edited by sevenam Tuesday, April 14, 2020 12:58 PM
    Tuesday, April 14, 2020 12:58 PM