I have an ASP.NET MVC 2 application.
in my case it is quite tricky. Reference to ExternalAssembly2 is not required to Build the project but vital for run-time since we use reflection to configure Unity container. So, I delete the reference - build the project successfully, but get run-time error. If I preserve the reference I can Build and Run the application but I cannot Publish it with ExternalAssembly2 - get run-time exception as well. This is happen because of internal VS2010 assemblies optimization.
So, what we can do here? 1. Put some unrequired peice of code to use any ExternalAssembly2's class. 2. escape from reflection and use static assemblies linking.
Hope this helps to smbd.