是否有办法让所有依靠特定集会的集会?
Pseudo:
Assembly a = GetAssembly();
var dependants = a.GetDependants();
是否有办法让所有依靠特定集会的集会?
Pseudo:
Assembly a = GetAssembly();
var dependants = a.GetDependants();
如果你希望从目前申请领域找到附属议会,你可以使用像<代码”这样的东西。 下面界定的“选择权”功能:
private IEnumerable<Assembly> GetDependentAssemblies(Assembly analyzedAssembly)
{
return AppDomain.CurrentDomain.GetAssemblies()
.Where(a => GetNamesOfAssembliesReferencedBy(a)
.Contains(analyzedAssembly.FullName));
}
public IEnumerable<string> GetNamesOfAssembliesReferencedBy(Assembly assembly)
{
return assembly.GetReferencedAssemblies()
.Select(assemblyName => assemblyName.FullName);
}
The analyzedAssembly
parameter represents the assembly for which you want to find all the dependents.
在方案方面,您可使用
Something like this (note this won t work if the debugger is attached - e.g. if you run it from inside VS itself): If you don t need to do this programatically, then NDepend or Reflector can give you this information.public static IEnumerable<string> GetDependentAssembly(string assemblyFilePath)
{
//On my box, once I d installed Mono, Mono.Cecil could be found at:
//C:Program Files (x86)Mono-2.10.8libmonogacMono.Cecil .9.4.0__0738eb9f132ed756Mono.Cecil.dll
var assembly = AssemblyDefinition.ReadAssembly(assemblyFilePath);
return assembly.MainModule.AssemblyReferences.Select(reference => reference.FullName);
}
首先界定你的范围,例如:
我申请的所有集会
我申请的所有集会 + all assemblies in the GAC
世界上所有机器的集会。
然后,仅(*)通过你范围的所有议会进行播音,如果它们取决于你们的目标组合,则采用反思来检查。
如果你想要间接和直接提及,你就不得不为你发现的所有集会洗衣和重复。
(*) 如果你的范围是上面的3个,那么情况并不简单。
I m not aware of any built-in possibility to get dependencies at runtime. So I think the easiest solution is define an extension method and use code from this application. I used an application itself a years ago. But do not use code of it.
希望这一帮助。
What is the use of default keyword in C#? Is it introduced in C# 3.0 ?
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association ...
How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...
Since I cannot order my dictionary, what is the best way of going about taking key value pairs and also maintaing an index?
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...