Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
|
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 25th, 2006, 08:05 AM
Registered User
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help for unloading the assembly in c#

I've still can't resolve this case: (mentioned in previous topic by "amirxy")

"
im talking about this case :
i have winapp that use dll (assembly)
im createing in runtime object from the assembly.
the destroy this object.

THEN , while the winapp is STILL RUNNING , i want to Recompile the dll (assembly) , and to use the winapp AGAIN to create object from that assembly .(this way i could ,change the code of the object ,if i found bug, and use it again).
"

really appretiate for giving me a solution!

 
Old March 25th, 2006, 08:27 AM
Registered User
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

    class Program
    {
        static void Main(string[] args)
        {
            MyTest.Test();
        }
    }


    public class MyTest
    {
        public static void Test()
        {
            string assemblyFile = @"D:\XC.dll"; //the assebmly file I want to load

            string typeName = "XC.Form1"; //the Type I want to create which implement the IXC interface
            //and the IXC interface was in the assembly "winapp.dll"

            AppDomain appDomain = AppDomain.CreateDomain("Domain test");

            try
            {
                ObjectHandle oh = appDomain.CreateComInstanceFrom(assemblyFile, typeName);
                object o = oh.Unwrap();
                IXC ixc = (IXC)o; /*when it goes to here, I got
                $exception {"Type 'XC.Form1' in assembly 'XC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable."} System.Exception {System.Runtime.Serialization.SerializationExcepti on}*/
            }
            catch (Exception ex)
            {
            }
        }
    };






Similar Threads
Thread Thread Starter Forum Replies Last Post
help please with loading and unloading forms Teachme32 General .NET 2 January 4th, 2008 10:01 AM
Loading & Unloading roy.supratim05 Visual Studio 2005 1 May 18th, 2007 06:16 AM
Converting .NET 2.0 Assembly to .Net 1.x Assembly pskaushik .NET Framework 2.0 1 November 25th, 2006 01:51 PM
Assembly arv1980 VS.NET 2002/2003 1 January 15th, 2006 11:42 PM
Assembly arv1980 .NET Framework 2.0 1 January 15th, 2006 02:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.