assemblies

Hooking into an “OnLoad” for class library

最后都变了- 提交于 2019-11-29 08:14:41
Does anyone know if there's a way to hook into an "OnLoad" event to run some operations when an assembly loads? Specifically, I am creating a plug-in for an application. The plug-in's DLL gets loaded and objects start being used, but the problem is I need to load another assembly dynamically before anything happens. This assembly can't be copied to the application's directory and must remain invisible to it. You need to hook on to AssemblyLoad event. Refer- http://msdn.microsoft.com/en-us/library/system.appdomain.assemblyload.aspx It is really sad that writing a Main() function in an Assembly

Using Precompiled .NET Assembly DLL in Mono?

允我心安 提交于 2019-11-29 07:18:29
问题 We're currently testing Mono to see if our .NET DLLs will work for customers on Linux. Our DLLs provide components for Windows Forms. I placed the DLLs in the Debug directory, added the references, and created a class deriving from a Windows Form. The class had run fine standalone, but after I added the DLL references and created one of our components (the intellisense worked fine), it compiles but will not run: ** (/home/aldwin/testMonoWF/testMonoWF/bin/Debug/testMonoWF.exe:26905): WARNING *

How do I create a .NET assembly in IronPython and call it from C#?

99封情书 提交于 2019-11-29 06:21:25
问题 I want to create an assembly using IronPython can call it from C#. Here are two things I am not asking. I'm not asking how to call C# from IronPython. The easiest documentation to find describes how to call C# from inside IronPython. (For example, the tutorial that ships with IronPython.) I want to do the opposite, call IronPython from C#. I'm not asking how to embed the IronPython interpreter. I've found several useful references (e.g. here and here) on how to call the IronPython interpreter

Why would System.Type.GetType(“Xyz”) return null if typeof(Xyz) exists?

a 夏天 提交于 2019-11-29 06:11:51
问题 I have come across a strange behaviour in my (huge) .NET 4 project. At some point in the code, I am referring to a fully qualified type, say: System.Type type = typeof (Foo.Bar.Xyz); later on, I do this: System.Type type = System.Type.GetType ("Foo.Bar.Xyz"); and I get back null . I cannot make sense of why this is happening, because my type name is correct, and I have checked with other types and they get resolved properly. Moreover, the following LINQ query finds the type: var types = from

Get the Assembly path C#

▼魔方 西西 提交于 2019-11-29 06:06:14
Im trying to know the path of a dll.... several sites says that ive to use System.Reflection.Assembly.GetExecutingAssembly().Location BUT it returns a path in C:\Windows\Microsoft.Net ... etc... \File.Dll and i want c:\MyProyect\MiWeb\Bin\File.Dll any help ? Reed Copsey You can do this using: string file = (new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).LocalPath; The Location of the assembly changes based on redirects and shadow copy. Try using the Codebase property instead. That may actually be the path the program is using... IIRC, It starts out searching for the method call in

How can I list all registered assemblies in GAC?

和自甴很熟 提交于 2019-11-29 05:46:19
问题 How can I list all the assemblies that are in the GAC? Do I need a tool that makes it easy to view them? 回答1: You can use gacutil provided with Visual Studio for that. Simply open the Developer Command Prompt (available in Start Menu>App>Visual Studio) and run the following command: gacutil -l >yourassemblies.txt Gacutil is also available as a separate download if you don't have/want Visual Studio. 回答2: If you need the output in text-form, you can use gacutil /l. If you need to get that list

Consider app.config remapping of assembly with no app.config mapping

时光怂恿深爱的人放手 提交于 2019-11-29 05:31:58
How can I determine where to fix this reference without adding a binding to the app.config? Consider app.config remapping of assembly "System.Runtime.Serialization.Primitives, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.1.1.0" [] to Version "4.1.2.0" [F:\Production\packages\System.Runtime.Serialization.Primitives.4.3.0\lib\net46\System.Runtime.Serialization.Primitives.dll] to solve conflict and get rid of warning. 12>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3247: Found conflicts between different versions of the

how to use sn.exe -Vr

泪湿孤枕 提交于 2019-11-29 05:16:23
From the MSDN help, it says the -Vr option is: Registers assembly for verification skipping. My question is when the -Vr is used, will it only change the assembly file itself or it will change the system registry as well. This matters whether I should issue this command in the development machine or in the final deployed machine. sn -Vr creates an entry in the registry on the local machine. It does not modify the assembly. You must run sn -Vr locally on every machine on which you wish to skip verification of the target assembly's strong name. Since you mention that your concern is for a test

Assembly names and versions

三世轮回 提交于 2019-11-29 02:39:57
What is considered as best practice when it comes to assemblies and releases? I would like to be able to reference multiple versions of the same library - solution contains multiple projects that depend on different versions of a commonutils.dll library we build ourselves. As all dependencies are copied to the bin/debug or bin/release, only a single copy of commonutils.dll can exist there despite each of the DLL files having different assembly version numbers. Should I include version numbers in the assembly name to be able to reference multiple versions of a library or is there another way?

Find out dependencies of all DLLs?

孤人 提交于 2019-11-29 02:06:25
问题 I have a collection of DLLs(say 20). How do I find out all the DLLs on which one specific DLL (say DLL A) is depending upon? 回答1: If you mean programmatically, use Assembly.GetReferencedAssemblies. You can use that recursively to find all the assemblies you need. (So you find the dependencies of X, then the dependencies of the dependencies, etc.) 回答2: Since the question is tagged "C#", I would assume you are talking about managed dlls (assemblies). In that case, dependencywalker is not useful