assemblies

How to get all types in a referenced assembly?

*爱你&永不变心* 提交于 2019-12-04 15:02:01
问题 For whatever reason, I can't seem to get the list of types in a referenced assembly. Not only that, I can't even seem to be able to get to this referenced assembly. I tried AppDomain.CurrentDomain.GetAssemblies() , but it only returns assemblies that have already been loaded into memory. I tried Assembly.GetExecutingAssembly().GetReferencedAssemblies() , but this just returns mscorlib. What am I missing? 回答1: Note that Assembly.GetReferencedAssemblies only includes a particular assembly if

Having problems when two of referenced assemblies both define type A.A1

被刻印的时光 ゝ 提交于 2019-12-04 14:05:00
If two assemblies both define namespace A containing class A1 , then the two classes are considered unique types. a) Are the two namespaces also considered unique? b) If program P has a reference to both assemblies, how do we create an instances of the two types? Namely, I keep getting an error when I try to create an instance of A.A1 using A; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { A1 a = new A1(); // error } } } c) But if program P also defines type B.A1 , then compiler doesn’t complain when I declare an instance of A1 : using A; namespace

How to create a Plugin Model in .NET with Sandbox?

╄→гoц情女王★ 提交于 2019-12-04 13:03:29
Is there a way to load a .NET Assembly into a Sandbox environment that is also restricted in custom ways? I know you can run an Assembly in a different AppDomain, but can you limit it from being able to do certain things that you want to restrict? For example: I want to be able to load up a Plugin (simple, just defined via a specific interface) within a separate Assembly within an ASP.NET application, but I only want the plugin to be able to access certain Data Access Layer component and not be able to connect to any databases directly. I'm thinking about the scenario of having a single

GAC Assembly Missing in Add Reference dialog

a 夏天 提交于 2019-12-04 12:31:38
问题 I have an Interop assembly lying in GAC; Windows Explorer clearly shows it listed in the C:\WINDOWS\assembly folder. Yet, when I try to add a reference to it in from Visual Studio, I can't see it anywhere in the Add Reference dialog. If this is happened to you too, what is the reason for this? And how do I fix this? (The assembly is actually located in C:\WINDOWS\assembly\GAC_MSIL folder, if you must know.) 回答1: Add one of the following registry keys, where is the directory to search, and

Is there a description of the IL disassembler icons available somewhere

泄露秘密 提交于 2019-12-04 11:53:33
问题 I'm playing around with the MS IL disassembler, which lets you view the contents of a .Net assembly. The classes and Interfaces are shown in a tree view, nicely encoded with colors and icons. It's rather easy to guess the meaning of most icons, e.g. a blue icon with a capital 'I' inscribed is an interface, a grey one with an 'E' in it is an enumeration, but some items -- esp. the ones you get to see when you open an node -- are not always that easy to guess (maybe it's just me). What is the

Create Your Own .NET Assembly Cache

自古美人都是妖i 提交于 2019-12-04 11:18:50
In a .net application I am writing, I need to locally cache assemblies from various locations so my application can use them even if the original locations are unavailable. I cannot use the GAC (primarily because I want portability and also because the assemblies might not be signed). Does anyone know of any .net code which supports this functionality already? I need the cache to be able to tell me if a particular assembly is already in the cache and handle different versions of assemblies as well. It is likely that I will have to resort to writing my own assembly cache, but I thought I would

What is the earliest entrypoint that the CLR calls before calling any method in an assembly?

本秂侑毒 提交于 2019-12-04 10:48:51
In the past years I've occasionally been wondering what equivalent of the (in)famous DLL_PROCESS_ATTACH was available in the .NET world. Any documentation I have says, slightly simplified, that the earliest entry point to a class is the static constructor (cctor), but you cannot influence when it is called , nor can you define one cctor that's guaranteed to be called prior to any other cctor or field initializer, hack, it may not even be called at all if the class is never used. So, if you want to guarantee something's initialized before any method of your assembly is called and you don't want

How can I patch .NET assemblies?

泪湿孤枕 提交于 2019-12-04 09:53:21
If I compile a C# project twice, I will get two assemblies. These assemblies aren't exactly the same (using a binary diff). I can think of reasons why this is so, but the fact remains that the source for the two assemblies are identical. I am concerned with creating a patch between these assemblies, and applying the patch on a customer machine. Does anyone know of a library (preferably .NET) or tool with which I can create and apply patches? Ideally it should also handle small changes, like changing dependencies on a project level or tweaking a few lines in the source. It does not have to be

Could not load file or assembly for Oracle.DataAccess in .NET

我的梦境 提交于 2019-12-04 08:51:44
问题 When I try to run a simple program to access oracle I am getting this message Could not load file or assembly 'Oracle.DataAccess, Version=2.111.7.20, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified. I checked \windows\assembly and it's in there, but it's not in GAC ( gacutil -l ). I can't add into GAC ( gacutil -i [path] . I get 'unknown error'. Anyone has the same experiencing? 回答1: I'm going to give you the answers from

Single assembly from multiple projects

扶醉桌前 提交于 2019-12-04 07:24:54
In a .net application involving several projects in one solution, I have a project with the namespace set to Company.Product.UI and another one with Company.Product.UI.WebPages. My problem is that two dlls result from building the two projects. How can I have a single dll and still preserve the current solution structure. I use Visual Studio 2008 and C#. You will have to either merge the two projects into one project or use a tool like ILMerge to merge the resulting assemblies into a single assembly. ILMerge is a utility that can be used to merge multiple .NET assemblies into a single assembly