我正在嘗試使用p4api.net apis開發基於C#的構建工具。我是perforce p4api.net的新手。我遵循從他們的網站下載的p4api.net庫中給出的指示,但是從未成功地在perforce上運行基本命令。我附加了一段代碼,它應該可以從Perforce獲取客戶端。如果我錯了,請糾正它。該代碼在執行GetClients()時拋出運行時錯誤(未處理的期望)。無法檢索perforce客戶端
static void Main(string[] args)
{
string uri = "perforce:1666";
string user = "User1";
Server server = new Server(new ServerAddress(uri));
Repository rep = new Repository(server);
Connection con = rep.Connection;
con.UserName = user;
con.Client = new Client();
// connect to the server
con.Connect(null);
// run the command against the current repository
IList<Client> changes = rep.GetClients(null);
}
任何有用的指南,執行C#文件/示例將不勝感激。
感謝, 馬杜
嘿,非常感謝您的回覆。現在它工作正常。我所做的是,我開始執行perforce客戶端(即執行perforce ticket)並重新運行我的代碼。我該如何解決這個問題?運行構建工具的機器不會使Perforce客戶端始終處於啓動狀態並運行有效的故障單。 – 2012-07-27 13:19:37