问题
I have installed Visual Studio 2011 beta, and have found that a website I was working on has since stopped working. It has been suggested that there is an MVC
or Razor
assembly from the GAC which is loading and taking over. How would I check this?
回答1:
Run the application in Debug mode and watch the Output window
in Visual Studio. It will list every assembly as it is loaded, you will recognize GAC assemblies easily by its full file path.
回答2:
Just of interest let's do it i runtime. The idea is - check out Assembly.GlobalAssemblyCache property of all loaded MVC assemblies.
Put the following code snippet somewhere in Page_Load()
and see in a file whether specific assembly was loaded from GAC:
using System.Linq;
var items = AppDomain.CurrentDomain
.GetAssemblies()
.Where(a => a.FullName.Contains("MVC"))
.Select(a => String.Format(
CultureInfo.InvariantCulture,
"[{0}] {1}",
a.GlobalAssemblyCache,
a.FullName));
File.WriteAllLines("c:\\assembliesdump.txt", items .ToArray());
Output will be like shown below (log4net filter as example):
[False] log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821
来源:https://stackoverflow.com/questions/9571658/how-to-identify-if-a-gac-assembly-is-loading