I have a custom MSBuild task(resides in assembly A) to build a custom project type(let's call it 'TestAppContent'). 'A' references another assembly 'B' that is currently under development.

To test 'B', I use a test program, TestApp. TestApp depends on TestAppContent getting build using our custom task.

The problem is that after the task is loaded, 'B' assembly is locked by MSBuild or VisualStudio process as the assembly that contains the task('A') has a reference to it.

As I can't simply 'unload' an assembly and using separated AppDomain doesn't work, how can I stop this lock?

I know that Microsoft XNA can do this as you can supply custom assemblies to the build process and they are released after it so you can rebuilt those custom assemblies.