assemblies

How to prevent a .NET application from loading/referencing an assembly from the GAC?

℡╲_俬逩灬. 提交于 2019-11-27 08:49:15
Can I configure a .NET application in a way (settings in Visual Studio) that it references a "local" assembly (not in GAC ) instead of an assembly within the GAC, although both assemblies have the same name and the same version? If both assemblies are strong-named (signed), the CLR will always load from the GAC. Here are the steps the runtime uses to resolve assembly references (from How the Runtime Locates Assemblies ): Determines the correct assembly version by examining applicable configuration files, including the application configuration file, publisher policy file, and machine

Howto load assemby at runtime before AssemblyResolve event?

核能气质少年 提交于 2019-11-27 08:44:22
Actually i tried to implement some kind of 'statically linked' assemblies, within my solution. So i tried the following: Adding a reference to my assembly with CopyLocal = false Adding the .dll file itself to my solution with 'Add as link' Adding the .dll file itself to my resources with 'Add Resource' - 'Add Existing File' Adding some type out of my assembly into Form1 as private MyObject temp = new MyObject(); After these steps i got the FileNotFoundException as expected. So let's try to load the assembly within the AssemblyResolveEvent with this quick hack AppDomain.CurrentDomain

AssemblyResolve event is not firing during compilation of a dynamic assembly for an aspx page

情到浓时终转凉″ 提交于 2019-11-27 08:10:21
问题 This one is really pissing me off. Here goes: My goal is to load assemblies at run-time that contain embedded aspx,ascx etc. What I would also like is to not lock the assembly file on disk so I can update it at run-time without having to restart the application (I know this will leave the previous version(s) loaded). To that end I have written a virtual path provider that does the trick. I have subscribed to the CurrentDomain.AssemblyResolve event so as to redirect the framework to my

Target non specific version of an assembly

一个人想着一个人 提交于 2019-11-27 08:01:15
问题 I m trying to not target a specific version of a dll but I m not quite sure how. I have set the option Specific Version on the properties of the assembly to false, however if i try to run the application and the version of the requested assembly is a previous one, I get a: FileLoadException: Could not load file or assembly This is happening when the version of the referenced dll does not exactly match the current one. I would believe that the issue is on how to reference this assembly. 回答1:

Difference between AppDomain.GetAssemblies and BuildManager.GetReferencedAssemblies

霸气de小男生 提交于 2019-11-27 07:34:58
Just wanted to know if there is any difference between the two, in the context of a fully trust asp.net mvc 2 application. The .NET Framework defers loading assemblies into the current AppDomain until they're needed. For example, if you call into a third-party library only from SomeMethod(), the third-party DLL normally won't be loaded until the first time SomeMethod() runs. AppDomain.GetAssemblies() gives you all assemblies which have already been loaded into the current AppDomain. BuildManager.GetReferencedAssemblies() returns a list of all assemblies referenced from Web.config and elsewhere

How to save DLLs in a different folder when compiling in Visual Studio?

烈酒焚心 提交于 2019-11-27 07:26:14
Let's suppose I have a Window Forms / Console Application C# project with some external references and references to other class library projects in the same solution too. When I build the Window Form project, I want the referenced libraries be stored in a different location (eg: bin\Release\Libraries ), and not in the same folder as the .exe . Is it possible to do? Alexei Levenkov There are 2 parts of your question: How to configure solutions to build assemblies/EXE into folders of your choice - this is configured through properties of the project in VS (project properties -> build -> output

Calling .NET methods from VB6 via COM visible DLL

瘦欲@ 提交于 2019-11-27 07:16:58
问题 I have created a .NET DLL which makes some methods COM visible. One method is problematic. It looks like this: bool Foo(byte[] a, ref byte[] b, string c, ref string d) VB6 gives a compile error when I attempt to call the method: Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic. I read that array parameters must be passed by reference, so I altered the first parameter in the signature: bool Foo(ref byte[] a, ref byte[] b, string

C# Dynamic Loading/Unloading of DLLs Redux (using AppDomain, of course)

北战南征 提交于 2019-11-27 07:01:41
问题 I've read as many different version of this question as are on Stack Overflow, as well as every blue link on the front page of 3 different Google searches for tutorials, as well as the MSDN (which is kind of shallow beyond executing assemblies). I can only think of my efforts to get Tao to work as a good test case, but believe me, I've tried with a simple string return, a double, a function with parameters, too. Whatever my problem is, it isn't Tao. Basically I want to create a

Can I run code from a .NET assembly from a command line?

≯℡__Kan透↙ 提交于 2019-11-27 06:59:28
问题 I have a .NET class library (as a .dll file) and that library contains a class with a static method. Is there a way to call that method from a command line? 回答1: Here is a guide on how to load a dll from Powershell and call methods in it. The most important part of the post are these commands: [C:\temp] PS:25 > notepad MyMathLib.cs (…) [C:\temp] PS:26 > csc /target:library MyMathLib.cs Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42 for Microsoft (R) Windows (R) 2005 Framework

Does .NET assembly size affect performance?

偶尔善良 提交于 2019-11-27 06:54:27
Does the size of a .net assembly affect performance at all? How about the number of assemblies in your windows forms/web forms project? Dan Blanchard From Microsoft's Patterns & Practices Improving .NET Application Performance and Scalability Chapter 5: Prefer Single Large Assemblies Rather Than Multiple Smaller Assemblies To help reduce your application’s working set, you should prefer single larger assemblies rather than multiple smaller assemblies. If you have several assemblies that are always loaded together, you should combine them and create a single assembly. The overhead associated