September 17, 2012

AppDomain AppendPrivatePath [obsolete]

Have you ever tried to append a private path to your default AppDomain using .NET 4.0? Well this worked for a long time without getting any warnings
AppDomain.CurrentDomain.AppendPrivatePath("plugins");
For some security reasons this method has been set obsolete and should not be used anymore. I found much posts on the internet regarding this issue but almost every post demonstrated how to create a new AppDomain using the AppDomainSetup where the PrivateBinPath can be set easily.

Well I don't want to create a new AppDomain but use the default AppDomain and append a private path. Today I found a solution to this problem which can be solved easily through the application configuration file.
<configuration> <!-- ... --> <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <probing privatepath="plugins;otherFolder;more"></probing> </assemblybinding> </runtime> <!-- ... --> </configuration>

No comments:

Post a Comment