简体   繁体   English

在Visual Studio 2012的Web应用程序中,哪里可以看到对程序集的现有引用?

[英]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. 我在Visual Studio 2012中只有几个Web应用程序,即IIS Web应用程序。 I am unable to find the list of already added referenced assemblies to the web application. 我找不到已添加到Web应用程序的引用程序集的列表。

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. 我需要检查这些版本,并确认在解决方案中重建其他项目时它们是否正在更新,但是除了\\bin文件夹中的直接Project DLL之外,我在任何地方都找不到引用列表。就像其他项目类型一样

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? 如果没有这样的列表,那么我如何确定Web Application's Bin文件夹中存在的特定DLL是通过“ Add Reference还是直接复制到其中的?

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

I don't have VS 2012 at work but in VS 2010 what you can do is either: 我没有VS 2012,但在VS 2010中,您可以执行以下操作之一:

  1. Unload the web application project (right click on the project, unload) and then right click, edit. 卸载Web应用程序项目(右键单击该项目,然后卸载),然后右键单击进行编辑。 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). 或者,打开项目所在的Windows文件夹,然后在notepad ++(或等效版本)中打开项目文件(.csproj)。

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
        }

    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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