views:

114

answers:

2

System.Reflection.Assembly.Load(System.IO.File.ReadAllBytes(path))

So this is a work around to not being able to use T4 to reflect or read other files in the project or solution without locking the binaries from this post. The comments imply a memory issue.

The comments talk about a no-unloading downside, would this be garbage collected while you are working?

would it be a memory leak if you T4 generate something using this code, change a file it worked off of or the T4 and then the T4 is re-run?

+2  A: 

It depends on the number and size of your assemblies. T4 recycles the code generation AppDomain after 25 runs, so it may not be a problem. More here: http://www.olegsych.com/2008/05/t4-architecture/

Oleg Sych
Excellent news, thanks.
Maslow
A: 

Hi

I think that the best way of doing this is to make a shadow copy of the assembly

Thank you Muse VSExtensions

Muse VSExtensions