50

I have a C#/ASP.Net solution in VS (2008) with several projects within it. When I try to compile it I get one error only:

Attempted to access an unloaded AppDomain

No line code, no project name, nothing. Just such error.

How can I pin down this error -- i.e. the cause, or even better -- how can I solve it and continue compilation?

Thank you in advance.

9 Answers 9

65

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.

1
  • I just had this today for the first time (after getting all latest code after forward integration into private branch). I am building using batch file calling devenv+arguments. then it opens logfile, and I got this. I ran batch again and this time no error
    – T.S.
    Dec 7, 2016 at 20:23
17

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!
2

There are many possibilities:

  1. Try resetting your Visual Studio's Setting.

  2. Or check all dlls which are referenced.

  3. Check all the namespaces which are being used in your application, Do they exist?
3
  • Thank you. Just remarks (1) other solutions are compiled just fine, (3) sure, I have namespaces in those projects. Nov 3, 2010 at 8:41
  • Did you try to reset you VS settings?
    – Mazhar Karimi
    Nov 3, 2010 at 10:11
  • Oh, sorry, yes, after (2) I also reset the settings. However there is no change at all. Nov 9, 2010 at 10:59
1

I am experiencing the same in Visual Studio 2012 - but ONLY on websites hosted on UNC share. My solution (when it occur) is to unload the web project and reload it again. Then in works for some time again.

The problem as I recall it is, that the hosted UNC share (or the workstation trying to access it) is running an x86 version of Windows, which does not allow to many open network connections.

In my experience these sort of problems disappear on true x64 environments.

Cheers.

0

it means, there is something in WebConfig/AppConfig not compatible and cannot load.

For ex. İf you published project, check app_data/publish profiles, delete them.

0
  1. Check your .sln file first if it is conflicted then delete it and update your svn folder and rebuild your solution.

  2. Rebuild your solution

2
  • Could you please clarify what you mean by "conflicted"? Oct 19, 2016 at 5:35
  • Solution file has nothing to do with it.
    – T.S.
    Dec 7, 2016 at 19:39
0

It's also possible that your unit test started up a thread but didn't close it. Ensure your threads are all closed before completion. It might be a good idea to verify all your unit tests are running and passing correctly.

0

Exit the local webserver(IIS express) from the system tray and delete asp.net temp files from temporary folder & then try clean,rebuild and run your application

-2

Following are the steps i followed to get rid of such error-

  • Press Windows+R , write %Temp% and hit enter. Now,delete all the temporary files from the directory.
  • Restart your visual studio.
  • Clean your project solution from Solution explorer in Visual studio List item.
  • Rebuild the project & Run . It should work expected.
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.