Unable to build dll that template has just used. Dll locked.

Jun 29, 2009 at 9:33 AM

Hello,

My template has an assembly statement refering to the RepositoryAdapter.dll and an import statement for the namespaces in it.

When i run the T4  "run custom tool" all goes well.

The problem happens when i try to build/rebuild the class project RepositoryAdapter ... i get the message below that debug\bin\RepositoryAdapter.dll  is locked....

Until now i am simply closing down the solution and then reopening it.  But there must be a smarter way.   Any ideas?

Thanks,

Paul

Here's the error i get when i try to build the dll that the template used is:

Error 4 Unable to copy file "obj\Debug\Templating.RepositoryAdapter.dll" to "bin\Debug\Templating.RepositoryAdapter.dll". The process cannot access the file 'bin\Debug\Templating.RepositoryAdapter.dll' because it is being used by another process. UI.Toolkit.Templating.RepositoryAdapter

Coordinator
Jul 4, 2009 at 5:30 PM

T4 host reuses the same AppDomain for 25 transformations to improve performance. This will lock all assemblies loaded in it. You can set CacheAssemblies value to TextTemplating key in Registry to disable caching, but it will still lock the assembly until next transformation occurs. I haven't found a better way to work around this other than unloading the solution.