Re: Activator.CreateInstanceFrom

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Wayne (MeNotYou_at_community.nospam)
Date: 02/08/05


Date: Tue, 8 Feb 2005 11:14:14 -0500

Thank you, that worked perfectly (once I figured out where to get the public
token).

BTW, the System.Windows.Forms.Button was just an example, I plan on using
this with my own assemblies. Also since it was already in the gac I figured
it simpler to test with instead of having to first create the assembly
strong name it and then put it in the GAC.

"NuTcAsE" <rao.ritesh@gmail.com> wrote in message
news:1107872991.184207.294840@c13g2000cwb.googlegroups.com...
> First of, if you wanted to create a System.Windows.Forms.Button
> instance you just new it up like:
>
> System.Windows.Forms.Button btn = new System.Windows.Forms.Button();
>
> Soecondly, Activator.CreateXXXX is used for late binding calls. One way
> you can create instances from GAC assemblies is to first load the
> assemly and then call create instance. For ex:
>
> Assembly assm = Assembly.Load ("MyAssembly, Version=1.0.0.0,
> Culture=neutral, PublicKeyToken=[something]");
> MyType type = (MyType) assm.CreateInstance ("MyAssembly.MyType");
>
> That will automatically probe the GAC to check for the MyAssembly
> assembly.
>
> You could also use Activator.CreateInstance function and specify the
> assembly and type name. For GAC assemblies i dont think
> CreateInstanceFrom will work.
>
> NuTcAsE
>



Relevant Pages

  • Re: .NET versioning
    ... >> If this isn't dll hell then it's awfully close. ... > xcopy deployment, which thus means avoid the GAC if possible. ... > 2) if required, and if you really have to, copy the files to the GAC. ... If you overwrite assemblies in the GAC ...
    (microsoft.public.dotnet.framework)
  • Re: GAC hell
    ... The only way to get at the GAC is by calling into the unmanaged fusion API's. ... Beware that the GAC uses fully qualified assembly names to store assembly references, because you don't know whether an assembly resides in the GAC, you also don't have a FQAN, this may result in false positives! ... But we've gotten so far off topic here, we're nowhere near my original question anymore, which had to do with determining which referenced assemblies are in the GAC and which are not. ... So, please if you have a small but complete sample that uses the Microsoft.Vsa namespace to generate/compile/Run "VBScript" and "JScript" scripting code, feel free to post it here. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Please explain why the GAC cannot be referenced
    ... Gac assemblies show up under the reference tab. ... Look through you referenced assemblies for the name of the assembly, ... Gac'd assemblies provide that function for you and the search order for assemblies starts at the gac to reduce performance issues. ... > old assembly from the GAC and install the newer version. ...
    (microsoft.public.dotnet.framework)
  • Re: Biztalk 2004 deployment problem
    ... installed in the GAC before they can be a part of a running BizTalk ... Each computer contains a GAC which must contain the assemblies that are ... BizTalk Server to process messages during run time, you must install all ... you can use the BizTalk Deployment Wizard to deploy ...
    (microsoft.public.biztalk.general)
  • Re: .NET versioning
    ... >> not* do this yourself because it is a return to Win32 DLL Hell. ... >> The GAC recognises only the .NET version, ... > No install processes, you copy the files. ... For assemblies in the GAC use publisher policy or recompile...this does not ...
    (microsoft.public.dotnet.framework)