英語で読む

次の方法で共有


AppDomain.ClearPrivatePath メソッド

定義

注意事項

AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. https://go.microsoft.com/fwlink/?linkid=14202

注意事項

AppDomain.ClearPrivatePath has been deprecated and is not supported.

注意事項

AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. http://go.microsoft.com/fwlink/?linkid=14202

プライベート アセンブリの場所を指定するパスを空の文字列 ("") にリセットします。

C#
[System.Obsolete("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. https://go.microsoft.com/fwlink/?linkid=14202")]
public void ClearPrivatePath();
C#
[System.Obsolete("AppDomain.ClearPrivatePath has been deprecated and is not supported.")]
public void ClearPrivatePath();
C#
[System.Obsolete("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public void ClearPrivatePath();
C#
public void ClearPrivatePath();
C#
[System.Obsolete("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[System.Security.SecurityCritical]
public void ClearPrivatePath();

実装

属性

例外

アンロードされたアプリケーション ドメインで操作しようとします。

次のコード例では、 メソッドを ClearPrivatePath 使用して、アセンブリの読み込み時に検索するプライベート パスの一覧からすべてのエントリを削除する方法を示します。

このメソッドは現在使用されなくなったので、新しい開発には使用しないでください。

C#
using System;
using System.Reflection;
using System.Security.Policy;

class ADAppendPrivatePath
{
    public static void Main()
    {
        //Create evidence for new appdomain.
        Evidence adevidence = AppDomain.CurrentDomain.Evidence;

        //Create the new application domain.
        AppDomain domain = AppDomain.CreateDomain("MyDomain", adevidence);

        //Display the current relative search path.
        Console.WriteLine("Relative search path is: " + domain.RelativeSearchPath);

        //Append the relative path.
        String Newpath = "www.code.microsoft.com";
        domain.AppendPrivatePath(Newpath);

        //Display the new relative search path.
        Console.WriteLine("Relative search path is: " + domain.RelativeSearchPath);

        //Clear the private search path.
        domain.ClearPrivatePath();

        //Display the new relative search path.
        Console.WriteLine("Relative search path is now: " + domain.RelativeSearchPath);

        AppDomain.Unload(domain);	
    }
}

注釈

プライベート パスは、共通言語ランタイムがプライベート アセンブリを検索するために検索するベース ディレクトリに対する相対パスです。

詳細については、「AppDomainSetup.PrivateBinPath」を参照してください。

適用対象

製品 バージョン (廃止)
.NET (Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9)
.NET Framework 1.1 (2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1)
.NET Standard (2.0, 2.1)

こちらもご覧ください