开发者

How can I get a list of files loaded by my process?

开发者 https://www.devze.com 2022-12-15 05:09 出处:网络
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 cre开发者_如何学G

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 cre开发者_如何学Goate a copy file list for my test deployment.

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

Thanks.


Process Explorer?


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

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


Check out AppDomain.GetAssemblies

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


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.


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.

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).

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号