Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / September 2005

Tip: Looking for answers? Try searching our database.

AppDomain.AppendPrivatePath Depricated

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jared Bienz - 16 Sep 2005 06:36 GMT
I get a CS0618 that AppDomain.AppendPrivatePath is obsolete. The
suggestion is to use AppDomainSetup.PrivateBinPath instead, but no
matter how I set it, PrivateBinPath remains null.

I am trying to update AppDomain.CurrentDomain after the domain is
started. Is AppDomainSetup the correct way to go? It seems this would
only apply at creation of the domain, and I need to make this
modification after the AppDomain has started.

I posted this to the Forums as well. I'm not clear whether the forums is
the right spot or here. They both seem to address the same issues.

Thanks
Nick Hertl - 16 Sep 2005 19:25 GMT
AppDomain.AppDomainSetup is a readonly property.
If you try to modify your AppDomain's SetupInformation property, the
change will disappear as fast as you make it, and here's why:

AppDomain.SetupInformation propetry is reference to an AppDomainSetup
object which you are free to modify, but this does not actually change
the underlying AppDomain's configuration.  The way to change the
AppDomain's setup would be to create a new AppDomainSetup object and
assign that to the SetupInformation property of your AppDomain like
this:

AppDomain ad = AppDomain.CreateDomain("mydomain");
AppDomainSetup ads = new AppDomainSetup();
ads.PrivateBinPath = mynewpath;
ad.SetupInformation = ads;      // <--  Won't compile because
SetupInformation is a readonly property
ad.SetupInformation.PrivateBinPath = mynewpath;     // <-- Won't work
because the appdomain's SetupInformation is never actually changed

The right way to do this is to know what your PrivateBinPath will need
to be before setting up the domain and then have code that looks
something like this instead:

AppDomainSetup ads = new AppDomainSetup();
ads.PrivateBinPath = mybinpath;
AppDomain ad = AppDomain.CreateDomain(mydomainname, null, ads);
Console.WriteLine("PrivateBinPath: {0}",
ad.SetupInformation.PrivateBinPath);

The main reason for this change is that you should not be changing the
PrivateBinPath for an AppDomain once it has been created.  It would
change the binding after Assemblies may have already been bound in that
AppDomain.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.