简体   繁体   中英

Where to see the existing references to assemblies in a web application in visual studio 2012?

I have few web applications in Visual Studio 2012 which are IIS Web Applications. I am unable to find the list of already added referenced assemblies to the web application.

I need to check the versions of those and need to confirm whether they are getting updated when the other project's are rebuilt in the solution, but other than the direct Project DLLs in the \\bin folder, I can't find a list of references anywhere like in other project types.

And if there is no such list, then how will I find whether a particular DLL present in the Web Application's Bin folder was added via Add Reference or was directly copied into it?

不确定是否相同,但是在VS 2013中,右键单击“项目”->“属性页”,然后选择左侧的“引用”。

I don't have VS 2012 at work but in VS 2010 what you can do is either:

  1. Unload the web application project (right click on the project, unload) and then right click, edit. You'll then see a list of all references.
  2. Alternativly, open the windows folder where your project exists and open your project file (.csproj) in notepad++ (or equivalent).

Hope I've understood your question correctly!

I'll give you my code stripped out, so it's not "ready" solutoin, but the assumption is you know the list of main assemblies and you want to know if any referenced by those assemblies are missing

    private void PopulateReferencedButMissingAssemblies(List<string> listOfKnowAssymblies)
    {
        HashSet<string> missingRefs = new HashSet<string>();

        foreach (string assemblyName in listOfKnowAssymblies)
        {
            Assembly parent = Assembly.Load(assemblyName);
            AssemblyName[] refs = parent.GetReferencedAssemblies();

            foreach (AssemblyName d in refs) //checking references
            {
                try
                {
                    Assembly subRef = Assembly.Load(d.FullName);
                    subRef = null; //release loaded assembly
                }
                catch
                {
                    missingRefs.Add(d.FullName);
                }
            }
        }

        if (missingRefs.Count == 0)
        {
            //refsPanel.Visible = false;
            //return;
        }


        foreach (string mref in missingRefs)
        {
            //display missing refs in my case
        }

    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM