如何获取由进程加载的文件列表?

时间:2022-11-24 15:50:12

I'm trying to do a quick and dirty deployment of a project. I thought it would be easy to run my process, use some tool to grab a list of all loaded files (DLLs) and use that list to create a copy file list for my test deployment.

我正在尝试快速而肮脏地部署一个项目。我认为运行我的进程会很容易,使用一些工具获取所有已加载文件(dll)的列表,并使用该列表为我的测试部署创建一个复制文件列表。

Thought about using filemon but there is a lot of noise in there. Its a .net project.

考虑过使用filemon,但是里面有很多噪音。一个。net项目。

Thanks.

谢谢。

5 个解决方案

#1


0  

You should be able to use .NET's Reflection to analyze your application AppDomain(s) and dump a list of loaded assemblies and locations.

您应该能够使用. net的反射来分析应用程序AppDomain(s)并转储已加载程序集和位置的列表。

var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in loadedAssemblies)
{
    Console.WriteLine(assembly.GetName().Name);
    Console.WriteLine(assembly.Location);
}

#2


1  

Process Explorer?

进程浏览器吗?

#3


0  

Check out AppDomain.GetAssemblies

看看AppDomain.GetAssemblies

For Each Ass As Reflection.Assembly In CurrentDomain.GetAssemblies()
    Console.WriteLine(Ass.ToString())
Next

#4


0  

This is answered in another question already.

这是另一个问题的答案。

The gist of it is use current appdomain to get a list of assemblies and loop through their loader location.

它的要点是使用当前appdomain获取一个程序集列表,并通过它们的加载器位置进行循环。

#5


0  

If I have understood your question, to do a fast deployment you can set in all the references of your project but the Framework ones the setting "Copy Local" to true.

如果我理解了您的问题,要进行快速部署,您可以在项目的所有引用中设置,但是在框架中设置为“Copy Local”到true。

This way when you build your application you will have all the needed DLLs at your output directory (well, almost all, references needed by your references won't be copied automatically, so it's best to add them as a local reference too).

这样,当您构建应用程序时,您将在输出目录中拥有所有需要的dll(几乎所有引用所需的引用都不会自动复制,所以最好也将它们作为本地引用添加)。

Hope this helps. If not, just say why, I will try to continue on this.

希望这个有帮助。如果没有,就说为什么,我会继续努力。

#1


0  

You should be able to use .NET's Reflection to analyze your application AppDomain(s) and dump a list of loaded assemblies and locations.

您应该能够使用. net的反射来分析应用程序AppDomain(s)并转储已加载程序集和位置的列表。

var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in loadedAssemblies)
{
    Console.WriteLine(assembly.GetName().Name);
    Console.WriteLine(assembly.Location);
}

#2


1  

Process Explorer?

进程浏览器吗?

#3


0  

Check out AppDomain.GetAssemblies

看看AppDomain.GetAssemblies

For Each Ass As Reflection.Assembly In CurrentDomain.GetAssemblies()
    Console.WriteLine(Ass.ToString())
Next

#4


0  

This is answered in another question already.

这是另一个问题的答案。

The gist of it is use current appdomain to get a list of assemblies and loop through their loader location.

它的要点是使用当前appdomain获取一个程序集列表,并通过它们的加载器位置进行循环。

#5


0  

If I have understood your question, to do a fast deployment you can set in all the references of your project but the Framework ones the setting "Copy Local" to true.

如果我理解了您的问题,要进行快速部署,您可以在项目的所有引用中设置,但是在框架中设置为“Copy Local”到true。

This way when you build your application you will have all the needed DLLs at your output directory (well, almost all, references needed by your references won't be copied automatically, so it's best to add them as a local reference too).

这样,当您构建应用程序时,您将在输出目录中拥有所有需要的dll(几乎所有引用所需的引用都不会自动复制,所以最好也将它们作为本地引用添加)。

Hope this helps. If not, just say why, I will try to continue on this.

希望这个有帮助。如果没有,就说为什么,我会继续努力。