DeploymentBaseOptions.ComputerName 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定電腦的名稱。
public:
property System::String ^ ComputerName { System::String ^ get(); void set(System::String ^ value); };
public string ComputerName { get; set; }
member this.ComputerName : string with get, set
Public Property ComputerName As String
屬性值
包含電腦名稱稱的字串。
範例
下列範例會實作 類別的 DeploymentBaseOptions 數個屬性。 這個範例會同時具現化 DeploymentBaseOptions 來源和目的地物件的 ,並修改屬性值以啟用遠端同步作業。
using System;
using Microsoft.Web.Deployment;
namespace MSDeploy.Web.Deployment
{
class Program
{
static void Main(string[] args)
{
// Example to show how DeploymentBaseOptions can be used
string _directory = Environment.ExpandEnvironmentVariables(
@"%systemdrive%\inetpub\wwwroot");
DeploymentSyncOptions syncOptions =
new DeploymentSyncOptions();
DeploymentBaseOptions sourceBaseOptions =
new DeploymentBaseOptions();
sourceBaseOptions.ComputerName = "sourceMachineName";
sourceBaseOptions.IncludeAcls = true; // false by default
sourceBaseOptions.UserName = "username";
sourceBaseOptions.Password = "password";
DeploymentBaseOptions destinationBaseOptions =
new DeploymentBaseOptions();
destinationBaseOptions.ComputerName =
"destinationMachineName";
destinationBaseOptions.UserName = "username";
destinationBaseOptions.Password = "password";
DeploymentObject deploymentObject =
DeploymentManager.CreateObject("contentPath",
_directory, sourceBaseOptions);
deploymentObject.SyncTo(
DeploymentWellKnownProvider.ContentPath, _directory,
destinationBaseOptions, syncOptions);
}
}
}
備註
此值可能是 UNC 路徑中指定的名稱 (「[\\fabrikam\] (\fabrikam) 」) 、URL (「 http://www.microsoft.com 」「) 、 (」fabrikam「) 或 null Visual Basic) 中的 (Nothing 。