Cannot compile solution in VS due "Attempted to access an unloaded AppDomain" -- how to pin it down?

Solution 1:

Shut down Visual Studio and reopen it. Then clean the Temp folder.

For that press Windows+R and type %Temp% and click Ok, then delete everything.

Solution 2:

If this error comes with VS follow these steps

  1. Just restart your VS.
  2. Start VS again
  3. Clean the solution (Build> Clean Solution)
  4. Rebuild your project again

If this error comes with IIS

  • Restart (recycle) the IIS Application Pools in IIS Manager, After restarting check run the solution again!