2012-11-10 8 views
13

विंडोज स्टोर अनुप्रयोगों के लिए, यूनिट परीक्षण चलाने के लिए एक डेवलपर लाइसेंस की आवश्यकता होती है, जो व्यक्तिगत पर्सनल मशीन पर व्यक्तिगत डेवलपर के लिए ठीक है।विंडोज डेवलपर एप्लिकेशन पर विंडोज स्टोर यूनिट परीक्षण के लिए स्वचालित डेवलपर लाइसेंस प्राप्त करना

लेकिन बिल्ड सर्वर पर निरंतर एकीकरण प्रक्रिया के लिए, हमें वास्तव में लाइसेंस प्राप्त करने की क्षमता की आवश्यकता है।

माइक्रोसॉफ्ट एक कमांड लाइन उपकरण प्रदान करता है, लेकिन यह अभी भी एक इंटरैक्टिव विंडो बनाता है, जो प्रक्रिया को तोड़ देता है।

TailoredDeploy.exe AcquireDeveloperLicense 

तो क्या किसी को डेवलपर लाइसेंस स्वचालित रूप से प्राप्त करने के किसी अन्य तरीके से पता है? नए निर्माण नोड्स को स्पैनिंग नरक होने जा रहा है अगर इसे मैन्युअल सेटअप की आवश्यकता है। उनमें से प्रत्येक के लिए वीपीएन।

+0

अपना खुद का खाना बनाना: http://msdn.microsoft.com/en-us/library/windows/desktop/jj572812%28v=vs.85%29.aspx –

+0

http://social.msdn.microsoft.com/Forums/ en-US/toolsforwinapps/thread/7be92f16-7179-4d74-9915-c6f21e0f4c55 –

+1

समस्या को हल नहीं करता है। यह अभी भी उपयोगकर्ता बातचीत का अनुरोध कर रहा है। –

उत्तर

4

मैं UI Automation उपयोग करने के लिए सुझाव दिया गया था, और यहाँ है कि मैं क्या जादुई गया है अब तक:

using System.Diagnostics; 
using System.Threading; 
using System.Windows.Automation; 

class Program 
{ 
    static void Main(string[] args) 
    { 
     var processStartInfo = new ProcessStartInfo(@"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\TailoredDeploy.exe", "AcquireDeveloperLicense"); 

     var process = Process.Start(processStartInfo); 
     process.WaitForInputIdle(); 

     Thread.Sleep(1000); 

     var agreementWindow = AutomationElement.RootElement.FindFirst(TreeScope.Children, 
      new PropertyCondition(AutomationElement.ProcessIdProperty, process.Id)); 

     var iAgreeButton = agreementWindow.FindAll(TreeScope.Children, Condition.TrueCondition)[0] 
              .FindAll(TreeScope.Children, Condition.TrueCondition)[2]; 

     var buttonPattern = iAgreeButton.GetCurrentPattern(AutomationPattern.LookupById(InvokePattern.Pattern.Id)) as InvokePattern; 
     buttonPattern.Invoke(); 

     Thread.Sleep(10000); 

     var processes = Process.GetProcessesByName("dllhost"); 

     var credentialsWindows = AutomationElement.RootElement.FindAll(TreeScope.Children, 
      new PropertyCondition(AutomationElement.ProcessIdProperty, processes[0].Id)); 

     if (credentialsWindows[0].Current.Name == "Developer License") 
     { 
      var credentialsPane = credentialsWindows[0].FindAll(TreeScope.Children, Condition.TrueCondition)[0] 
                 .FindAll(TreeScope.Children, Condition.TrueCondition)[0] 
                 .FindAll(TreeScope.Children, Condition.TrueCondition)[0] 
                 .FindAll(TreeScope.Children, Condition.TrueCondition)[0] 
                 .FindAll(TreeScope.Children, Condition.TrueCondition); 

      var usernameTextBox = credentialsPane[3].GetCurrentPattern(AutomationPattern.LookupById(ValuePattern.Pattern.Id)) as ValuePattern; 
      usernameTextBox.SetValue("[email protected]"); 

      var passwordTextBox = credentialsPane[5].GetCurrentPattern(AutomationPattern.LookupById(ValuePattern.Pattern.Id)) as ValuePattern; 
      passwordTextBox.SetValue("password"); 

      var loginButton = credentialsPane[8].GetCurrentPattern(AutomationPattern.LookupById(InvokePattern.Pattern.Id)) as InvokePattern; 
      loginButton.Invoke(); 

      Thread.Sleep(10000); 

      var finishUpProcesses = Process.GetProcessesByName("TailoredDeploy"); 

      var finishWindow = AutomationElement.RootElement.FindFirst(TreeScope.Children, 
       new PropertyCondition(AutomationElement.ProcessIdProperty, finishUpProcesses[0].Id)); 

      var lastItems = finishWindow.FindAll(TreeScope.Children, Condition.TrueCondition)[0] 
             .FindAll(TreeScope.Children, Condition.TrueCondition); 

      var closeButton = lastItems[3].GetCurrentPattern(AutomationPattern.LookupById(InvokePattern.Pattern.Id)) as InvokePattern; 
      closeButton.Invoke(); 
     } 
    } 
} 

इस का उपयोग करने के लिए, एक app.manifest ऊंचा मोड में चलाने के लिए आवश्यक है:

<?xml version="1.0" encoding="utf-8"?> 
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/> 
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> 
    <security> 
     <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> 
     <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> 
     </requestedPrivileges> 
    </security> 
    </trustInfo> 
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
    <application> 
    </application> 
    </compatibility> 
</asmv1:assembly> 
बस
संबंधित मुद्दे