English 中文(简体)
是否需要有依赖的集会?
原标题:Get dependent assemblies?

是否有办法让所有依靠特定集会的集会?

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.

问题回答

首先界定你的范围,例如:

  1. 我申请的所有集会

  2. 我申请的所有集会 + all assemblies in the GAC

  3. 世界上所有机器的集会。

然后,仅(*)通过你范围的所有议会进行播音,如果它们取决于你们的目标组合,则采用反思来检查。

如果你想要间接和直接提及,你就不得不为你发现的所有集会洗衣和重复。

(*) 如果你的范围是上面的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.

希望这一帮助。





相关问题
Anyone feel like passing it forward?

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

NSArray s, Primitive types and Boxing Oh My!

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

C# Marshal / Pinvoke CBitmap?

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

How to Use Ghostscript DLL to convert PDF to PDF/A

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

Linqy no matchy

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

热门标签