I would like to determine whether or not a file has any dep开发者_JS百科endencies to the .net framework. The catch: I want to do this without the use of any third party application.
I was hoping there was some hidden method in existence that I could use for this.
Thanks for any help, Evan
Something along these lines:
Assembly a = Assembly.LoadFrom(
pathToAssembly);
AssemblyName [] an =
a.GetReferencedAssemblies();
foreach (AssemblyName name in an)
Console.WriteLine(name.ToString());
... Courtesy of Determining .NET Assembly and Method References
A .NET executable has special fields in its header that you can look for, but even native EXEs can implicitly rely on .NET, say by invoking a COM service that's written in .NET.
By nature, a C# application will most likely link against the standard C# libraries. If you are talking about another library, outside of the standard libraries, I don't know if that is possible. What exactly do you mean by 'third party' in this situation?
精彩评论