Ler em inglês

Compartilhar via


AppDomain.ClearPrivatePath Método

Definição

Cuidado

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

Cuidado

AppDomain.ClearPrivatePath has been deprecated and is not supported.

Cuidado

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

Cuidado

AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead.

Redefine o caminho que especifica o local dos assemblies privados para a cadeia de caracteres vazia ("").

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 ();
C#
[System.Obsolete("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead.")]
public void ClearPrivatePath ();

Implementações

Atributos

Exceções

A operação é tentada em um domínio de aplicativo descarregado.

Exemplos

O exemplo de código a seguir demonstra como usar o ClearPrivatePath método para remover todas as entradas da lista de caminhos privados para pesquisar quando os assemblies são carregados.

Este método agora está obsoleto e não deve ser usado no novo desenvolvimento.

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);	
    }
}

Comentários

O caminho privado é um caminho relativo ao diretório base que o common language runtime pesquisa para localizar assemblies privados.

Para obter mais informações, consulte AppDomainSetup.PrivateBinPath.

Aplica-se a

Produto Versões (Obsoleto)
.NET (Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7)
.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)
.NET Standard (2.0, 2.1)

Confira também