1

I get the following error when I try to use Run Custom Tool or Debug T4 Template from TypeLite.Net4.tt

ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

If I then try to build the project after I get this error:

Could not copy "obj\Debug\Shared.Web.dll" to "bin\Debug\Shared.Web.dll". Exceeded retry count of 10. Failed. The file is locked by: "T4VSHostProcess.exe (9848)"

TypeLite has worked before but for some reason it has stopped working now. TypeLite is generating files from two projects, Models is a referenced project to Shared.Web. Both these DLLs are present in bin\Debug\.

I read an answer here on SO about retrieving the LoaderException and getting more information but I don't know how to do this for T4.

https://stackoverflow.com/a/8824250/3850405

https://stackoverflow.com/a/4667152/3850405

Ogglas
  • 38,157
  • 20
  • 203
  • 266

1 Answers1

0

Solved by editing TypeLite.Net4.tt and include the other assembly explicitly. This has worked before so I can't answer why I have to do this now.

<#@ assembly name="$(TargetDir)Model.dll" #>
Ogglas
  • 38,157
  • 20
  • 203
  • 266