Dynamic Assemblies Loading?

Dec 22, 2009

Do you know any other alternative for dynamic assemblies loading? Other than the method below:

[Code]...

View 4 Replies


ADVERTISEMENT

C# - Dynamically Loading .NET Assemblies?

May 25, 2009

I am writing a program and I want the program to support plugins. I created an interface that the program must implement. I am using the following code from my main program to call the plugin:

Dim asm As Assembly = Assembly.LoadFrom(ff.FullName)
' Get the type
Dim myType As System.Type = asm.GetType(asm.GetName.Name + "." + asm.GetName.Name)
' If the type is null then we try again without the root namespace name

[code]....

I set this property from my main program and everything works. Except, after a while, m_PanelObject gets set to Nothing for some odd reason. I'm not setting it to Nothing anywhere in my program and there is no place in the plugin code that sets it to Nothing.

View 1 Replies

C# - Dynamically Loading Assemblies In .NET?

May 24, 2010

We've built a small component which takes an Id, looks up an entry in the database for an assembly/namespace/class, and dynamically loads an instance of the class that we're after. It has been working fine up until now, but when running this code in VS 2010, it's failing.

Private Function AssemblyLoaded(ByVal assemblyFile As String) As Assembly
Dim assemblies() As Assembly = AppDomain.CurrentDomain.GetAssemblies
For Each asmb As Assembly In assemblies

[Code]....

But it feels dirty. Is there a better way of checking if an assembly is already loaded, and handing that back to the caller? Are the issues above specific to .NET 4.0 or Visual Studio 2010? I haven't tried this outside the IDE as it requires fairly significant configuration.

View 2 Replies

C# - Loading An Assembly Using Assembly.LoadFrom() As The Assemblies Are Located In A Different Path?

Apr 2, 2012

I am loading an Assembly using Assembly.LoadFrom() as the assemblies are located in a different path from Application Base directory.

Dim oAssembly As Assembly = _
Assembly.LoadFrom("C:\MyFolder\" + ddlXlate.SelectedItem.ToString() + ".dll")

And I consume a Type from that assembly without any problem:

oXML = CType(oAssembly.CreateInstance(sBaseType + ".XlateContainer"), _
XlateBase.XlateContainer)

However, the problem occurs when I try to use a Type from this assembly from within another method like the one below:

oComboBox.DataSource = _
[Enum].GetValues(Type.GetType(sType + "+ItemEnum," + sAssemblyName))

sAssemblyName is the one I loaded using LoadFrom() actually. After it said it cannot find the assembly, I used AssemblyResolve event which solved my problem :Subscribing AssemblyResolve event :

AddHandler AppDomain.CurrentDomain.AssemblyResolve, _
AddressOf MyResolveEventHandler

Event Handler Method:

Private Shared Function MyResolveEventHandler(ByVal sender As Object, _
ByVal args As ResolveEventArgs) As Assembly
Return Assembly.LoadFrom("C:\PSIOBJ\" + args.Name + ".dll")
End Function

And I thought maybe the error occurs because it cannot find a dependent assembly defined in assembly manifest file I loaded using LoadFrom() already but when I checked the args.Name, I saw it was trying to load same assembly and after that it worked without any problem. So basically a type in the loaded assembly cannot be found before the event adding change.

My old code was using AppDomain.CurrentDomain.Load() and Assembly.Load() methods and they were working fine without the AssemblyResolve event. I was able to reach types in dynamically loaded Assembly from every where within the same AppDomain.

LoadFrom() can find dependencies automatically within the same requested assembly path and that couldn't be problem as everything this dll needs was there. So at first it looked like a AppDomain problem to me as it looks like it seems it can reach assemblies from Load context instead of LoadFrom context and I am now using LoadFrom context.But now it seems I should pass oAssembly instance evertwhere to use any type from the loaded assembly?Doesn't it load the assembly where I can reach it everywhere (same AppDomain) using simple Type.GetType(...) method?

View 2 Replies

[2005] Dynamic Add-on Component Loading?

Mar 16, 2009

I am currently developing an application that will be the "base" for several components (business reporting systems, order management, etc). The idea is that our customers will install this "mother application", and we will offer components that will slot into it, expanding the functionality.

Now, here's my idea for how to make this work. I have some of this basic functionality down, but I want to get other people's opinions, ideas and experiences with this sort of thing before I move too far in a direction that might not be the best way to go:

[Code]....

View 11 Replies

.net Dynamic Loading - Getting Invalid Cast Exception?

Jan 6, 2011

I've seen some other responses about this and they talk about interfaces but I'm pretty sure you can do this with classes and base classes but I can't this to work.[code]....When it tries to convert whatever Activator.CreateInstance(t) returns to the base class of type Behavior I'm getting invalid cast exception. That type should be of CharacterController which is defined as a child of Behavior so why wouldn't it let me cast that?

View 2 Replies

Deployment :: Dynamic Namespace (dll) Import (loading)?

Mar 9, 2012

I am using the Microsoft Encoder 4.0 dll's for capturing any activity. I have used registered dll as been imported in my project. but if the expression is not installed then there comes error in my application code.(actually the dll is missing to be used if expression encoder is not installed)."how to check for available dll and use it in my code?"

View 1 Replies

Dynamic Assembly Loading And Using 'Shared' Methods?

Dec 20, 2011

I now have a need to dynamically load a dll into my application and I've found the reflection/assembly information and it's fairly easy to implement so I thought I was on my way. However, I quickly found out that I'm only able to use 'shared' methods. What I was originally thinking was I could have one shared method 'library.beginprocess' and then that would make all the necessary calls to the other methods, but this doesn't work unless all the other methods and class level objects are also shared.

I feel like I'm missing something or somethings just going right over my head. I've looked at many, many sites and examples, but I've only run across examples that expose 1 method,[URL]..which explain how to implement a plugin architechture, which I have not tried yet, but maybe would allow me to keep my class structure the same without having to make everything shared?

View 14 Replies

VS 2010 Function Documentation And Dynamic Loading?

Mar 13, 2011

Since I've been writing my prgram, I felt the need to provide documentation in much the same way VS2010 does.I've searched everywhere I could, but all the references I could find where for older versions of the IDE.It appears there is no builtin facility to produce documentation and this sounds silly to me.I found external programs, but at 300$ a licence it's way over the top of my budget.Even the hints and tips stickied on this forum are out of date, as they refer to VS2005.So how should I produce inline documentation for my classes

View 4 Replies

C# - Dynamic Loading Working Fine, Except After The Executable Is ILMerged

Aug 16, 2011

I have a windows application that dynamically loads DLLs using Reflection.Assembly.LoadFrom(dll_file_name_here).

It works as expected, until I ILMerge the application with another DLL.

So this scenario works fine:

MyApp.exe
MyAppComponent.dll
Plugin.dll

Once I ILMerge MyApp.exe and MyAppComponent.dll resulting in:

MyApp.exe
Plugin.dll

Calling Reflection.Assembly.LoadFrom("Plugin.dll") seems to load successfully, however once I try to do anything with it eg:

foreach ( typeAsm in Reflection.Assembly.LoadFrom("Plugin.dll"))

I get an exception "unable to load one or more of the requested types. retrieve the loader exceptions property for more informtion".

The frustrating thing is I can't really debug it, because debugging pre merging works perfectly!

View 1 Replies

Dynamic Way Of Loading The Information From The XML File Into A Specific Object Property?

Aug 11, 2010

I currently have a XML file for an application I am developing. I have built a a XMLFile.GetContent function to read my XML File and load the content into a set of specific objects. These objects are then added to a collection and passed back to the main code to be loaded into the memory of the application.I am looking for a dynamic way of loading the information from the XML file into a specific Object Property. I have added comments to the function to show what I want to make dynamic.Content of XML File

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Config>
<IQSDataSources>[code].....

View 2 Replies

How To Assemble Assemblies

Jun 13, 2011

In my .aspx file I have:

<%@ assembly src="extensions.vb" %>
<%@ assembly src="debug.vb" %>

[code].....

View 2 Replies

.net - Stop Asp.net Looking For Assemblies In GAC?

Sep 20, 2011

I have started working on a legacy project (ASP.NET 1.1) which was done in an old machine (which I dont have access to). And I am unaware of the development environment settings used for building this project.

Nonetheless, I am able to build the project and deploy it all well from my machine (I created the full development enviroment locally). In my machine everything works great.But some screens where one of the assembly dlls (third party dlls) are used do crash on any machine other than mine! They probably do net get the proper assembly (with matching version or something), even though when I have put all the assemblies in bin (and used the same files while adding references to the project). .NET runtime probably tries to find them in the GAC of the other computers? Or probably in my system itself it loads from GAC and not from the bin? How could I know all this? The question is it runs perfectly fine on my machine, where the assemblies are at both places - in bin and in GAC.

I am lost what I should do to so that no matter which machine I deploy the project, it should always look in bin only! Also, I dont want to change the code in any way because its a legacy code and has been working all right since ages! Just some settings e.g. maching.config or soemthing?

View 1 Replies

C# - Get Assemblies Without Instantiating Them?

Mar 30, 2012

I am trying to get all assemblies in CurrentDomain using AppDomain.CurrentDomain.GetAssemblies() to write their FullName into a DropDownList, however if I don't instantiate them, they are not seen in returned array from GetAssemblies() in CurrentDomain.They are all added as Reference and in Reference folder of the solution. Only time I can get them from the GetAssemblies() is when I first instantiate them.How to overcome this problem with an easy and more generic way instead of instantiate them everytime when I add new Assembly, etc.Due to company policy, I have to obfuscate some parts of the images: All the assembilies are referenced in Reference folder:

View 3 Replies

Assemblies Not Being Loaded Properly?

Sep 19, 2009

I have a windows forms Application using DCOM to connect to another server in order to retrieve data from a database. The program works perfectly fine on my develeopment box both inside of and outside of the idea.However it throws an exception on my test box: System.Exception.... TYPE_E_CANTLOADLIBRARY. The error happens when accessing a property of on the the public DCOM classes. The property holds an instance of one of the private classes for the DCOM. I've compared the registries and all the relevant entries seem to be the same. When I compared the dumps I noticed that System.Config and System.XML werent loaded on the test machine, even though they are installed and appear to be in the GAC.

[Code]...

View 6 Replies

C# - Compare Compiled .NET Assemblies?

Mar 16, 2009

compare to compile .NET assemblies?

For example I have HelloWorld.dll (1.0.0.0) and HelloWorld.dll (2.0.0.0), and I want to compare differences how can I do this?

I know I can use .NET Reflector and use the Assembly Diff plugin. Are there any other good tools out there to do this?

View 5 Replies

Install Assemblies In The Gac Without The Gacutil?

Jul 18, 2010

I'm deploying a vb 2005 application that references crystal report XI release 2 components. How do i install these components to the gac? The client machine does not have gacutil and i don't know how to use msi to do the job. I have researched the web for answers without success.

View 6 Replies

.net - Extension Methods In Referenced Assemblies?

Sep 16, 2010

If I try to call my extension method which is defined like this:

Module LinqExtensions
<System.Runtime.CompilerServices.Extension()> _
Public Function ToSortableBindingList(Of TSource)(ByVal source As IEnumerable(Of TSource))

[code].....

View 1 Replies

Assemblies - Building An Object Browser ?

Dec 18, 2011

I thought I would practice using reflection by building an Object Browser similar to what's in VS2010.

The reflection part is easy enough, but I'm can't find any means of determining where all of the assemblies are installed. On my machine (Win 7) the GAC would seem to be located at C:Windowsassembly.

However, 4.0 assemblies look to be located at C:WindowsMicrosoft.NETassembly in either GAC_32 or GAC_MSIL.

VS Object Browser obviously knows where to look, you can even filter on "All Components" or select a framework version.

But when I look at the Object Browser in VS, I find that it lists assemblies from several different locations: For example...

CODE:

How does VS know to list these assemblies? Is there some registry key I'm missing that defines all of these locations?

View 2 Replies

C# - Strong Named Assemblies In Winforms

Feb 1, 2010

Ok, I've read every question on here about strong named assemblies and just want to clarify something. First though, from what I've read, GAC aside, strong named assemblies prevent a malicious 3rd party changing and impersonating your code. It'd be great to have some links to some real world examples of this kind of spoofing that happened pre strong named assemblies. If security or the GAC are not a concern, It seems that it's still advisable to strong name assemblies because:

(A) Clients who have strong named assemblies can only reference your assemblies if they are signed.

(B) Clients who do not have strong named assemblies can reference your assembly whether it's signed or not.

Is that a fair analysis?

View 1 Replies

Dynamically Referenced Assemblies And VBCodeProvider?

Mar 17, 2010

We have a large application that implements "scripting" (i.e, dynamically compiled user code that can include user-defined .dll references).

View 5 Replies

Passing Connection Strings Between Assemblies?

Sep 2, 2010

I have two executables that access a DLL containing Data Access Layer objects Each exe can have a different config containing info on server and database name, connection string etc.How do I pass the config info to the DAL objects?

Obviously I can pass the config strings to the DAL objects every time I instanciate one, but that seems messy and repetitive as every class in the DAL will require Properties for the Config strings..if there is a way for the instanciated DAL objects to read some properties from the calling object without me having to pass them explicitly?

View 2 Replies

Recompile Any Assemblies That Reference A Method?

Jan 7, 2010

I've recently reorganized some files on my current project and renamed the namespaces. Now whenever I try to reference a method from an object that I've instantiated I get told by the debugger that I need to recompile any assemblies that reference that method.

View 4 Replies

Redistribution Rights Of Interop Assemblies

Jan 8, 2010

I have developed an application that creates Excel and Word documents, hence, Interop.Word.dll and Interop.Excell.dl asre being included into the installation package.May I redistribute these dll's with my application package? And how does the Developers Licenses work?I live in SA and have heard that the redistribution rights may be different.

View 4 Replies

Reference Objects (from NET Assemblies) At Runtime?

Jan 8, 2010

I created a .net assembly, which works perfectly if I create before runtime. But i'd like to know if it's possible to reference at runtime. The reason is because i'm creating an application which will be used in several servers, and it will be reference that same .net assembly, but the .dll file will be in different location per server. I know that when I reference before runtime, the .net assembly it will be pointing to is from the original (or at least that's what I think).

View 2 Replies

Set An Application To Check Their Reference Assemblies?

Sep 19, 2009

How to set an application to check their reference assemblies first locally(root folder)then if fails globally(GAC)

View 4 Replies

Stripping Variable Names From Assemblies

Mar 29, 2010

I'm trying to reduce as much as I can my VB.Net assembly side, and I just figured out that all variable names were kept unchanged in the actual assembly. Since I tend to use pretty long var names, it adds up and, by running dotfuscator on my assembly, I could shrink it by as much as 10%.

[Code]...

View 2 Replies

VS 2010 Crystal Reports Assemblies?

Apr 17, 2012

I'm wondering if it's possible to check in the application start if the system has the correct assemblies installed to my application to work?Let me explain, i have a application that uses several reports, and to solve the problem of the first time open report, I run in another thread a dummy report. This works fine if the user has the crystal reports installed but if it doesn't the app stops working.

View 3 Replies

Access Values Of Dynamic Controls Added To Dynamic Tabpages?

May 8, 2011

i have created a dynamic tabpage and a dynamic tablelayoutpanel inside it then added dynamic textboxes and labels inside the tablelayoutpanel...the thing is , i am having a problem on how to access the value of those textboxes and labels and add them as new columns in the new table(tagpage) in mysql database, i can already create the table in the database but i cant add the new columns in it. heres the code for accessing the values of the labels and textboxes

error: NullReferenceException was unhandled....Object variable or With block variable not set.

sql = "alter table " & tbl_selected(counter) & " add " & frmMain.Controls("TLP_" & SecArrList_sp(counter2)).controls.item(SecArrList_sp(counter2) & "label" & counter).Text & " varchar(100) NULL;"

View 2 Replies

Dynamic LINQ Query Based On Dynamic Number Of Comboboxes?

Feb 5, 2010

I would like to bind a DataGridView to a different LINQ query every time (in order to reuse the same form/DGV for different queries), like this:

[Code]....

but the "Qry", and the number of comboboxes, and their field names would change every time.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved