I have described the problem in detail in these blog posts:http://brumlemann.blogspot.com/2008/12/msbuild-of-vs-solution-under-target.htmlhttp://brumlemann.blogspot.com/2008/12/why-it-is-error-for-msbuild-to-build.htmlA demo solution is described along with the necessary and sufficient conditions. The demo solution is attached.In short, the problem is that, under simple circumstances, the running of the UnregisterAssembly task on an assembly fails because one or more assemblies needed by the assembly loader (used during UnregisterAssembly) has already been cleaned away.As I have demonstrated in the attached solution and blogged about this will be triggered for example when a type in the depending assembly inherits from a type in the assembly it depends upon (even though the inheriting type is not exposed to COM)Calling devenv.exe is a sort of workaround that might work in many cases but this is not a good solution. One example is with TFSBuild where the promoted way is to list the solutions to build inside the TFSBuild.proj. Enabling cleaning of the build will then fail.
Version