AppDomain.ClearPrivatePath 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
注意
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
将指定专用程序集位置的路径重置为空字符串 ("")。
public:
void ClearPrivatePath();
public:
virtual void ClearPrivatePath();
[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 ();
[System.Obsolete("AppDomain.ClearPrivatePath has been deprecated and is not supported.")]
public void ClearPrivatePath ();
[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 ();
public void ClearPrivatePath ();
[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 ();
[<System.Obsolete("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. https://go.microsoft.com/fwlink/?linkid=14202")>]
member this.ClearPrivatePath : unit -> unit
[<System.Obsolete("AppDomain.ClearPrivatePath has been deprecated and is not supported.")>]
member this.ClearPrivatePath : unit -> unit
[<System.Obsolete("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. http://go.microsoft.com/fwlink/?linkid=14202")>]
member this.ClearPrivatePath : unit -> unit
abstract member ClearPrivatePath : unit -> unit
override this.ClearPrivatePath : unit -> unit
[<System.Obsolete("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. http://go.microsoft.com/fwlink/?linkid=14202")>]
abstract member ClearPrivatePath : unit -> unit
override this.ClearPrivatePath : unit -> unit
[<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>]
abstract member ClearPrivatePath : unit -> unit
override this.ClearPrivatePath : unit -> unit
Public Sub ClearPrivatePath ()
实现
- 属性
例外
在卸载的应用程序域上尝试该操作。
示例
下面的代码示例演示如何使用 ClearPrivatePath 方法从加载程序集时要搜索的专用路径列表中删除所有条目。
此方法现已过时,不应用于新的开发。
using namespace System;
using namespace System::Reflection;
using namespace System::Security::Policy;
//for evidence Object
int 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: {0}", 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: {0}", domain->RelativeSearchPath );
//Clear the private search path.
domain->ClearPrivatePath();
//Display the new relative search path.
Console::WriteLine( "Relative search path is now: {0}", domain->RelativeSearchPath );
AppDomain::Unload( domain );
}
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);
}
}
open System
//Create evidence for new appdomain.
let adevidence = AppDomain.CurrentDomain.Evidence
//Create the new application domain.
let domain = AppDomain.CreateDomain("MyDomain", adevidence)
//Display the current relative search path.
printfn $"Relative search path is: {domain.RelativeSearchPath}"
//Append the relative path.
let Newpath = "www.code.microsoft.com"
domain.AppendPrivatePath Newpath
//Display the new relative search path.
printfn $"Relative search path is: {domain.RelativeSearchPath}"
//Clear the private search path.
domain.ClearPrivatePath()
//Display the new relative search path.
printfn $"Relative search path is now: {domain.RelativeSearchPath}"
AppDomain.Unload domain
Imports System.Reflection
Imports System.Security.Policy
Class ADAppendPrivatePath
Public Shared Sub Main()
'Create evidence for new appdomain.
Dim adevidence As Evidence = AppDomain.CurrentDomain.Evidence
'Create the new application domain.
Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", adevidence)
'Display the current relative search path.
Console.WriteLine("Relative search path is: " & domain.RelativeSearchPath)
'Append the relative path.
Dim Newpath As [String] = "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)
End Sub
End Class
注解
专用路径是相对于公共语言运行时搜索以查找专用程序集的基目录的路径。
有关详细信息,请参阅 AppDomainSetup.PrivateBinPath。