none
Deploying Metro style apps to non-development systems

    Question

  • In the Windows Developer Preview Metro style apps can be deployed only to systems with a developer license. 

    To deploy the app, build a package in Visual Studio from the Store.Build Pacakage menu.  Build it for local use.  Copy the resulting package to the target machine and run the included Add-AppDevPackage.bat file.

    For information on acquiring a developer license see: http://msdn.microsoft.com/en-us/library/windows/apps/hh465430(v=vs.85).aspx
     

    Here is a version of the PowerShell script from that page which calls AcquireDeveloperLicense instead of CheckDeveloperLicense:

     

     

    Add-Type @"
    namespace AcquireDeveloper
    {
        using System;
        using System.Runtime.InteropServices;
      
    
    internal static class NativeMethods
    {
              
        [DllImport("WSClient.dll", EntryPoint = "AcquireDeveloperLicense", SetLastError = true)]
        public static extern int AcquireDeveloperLicense(IntPtr hwnd, out System.Runtime.InteropServices.ComTypes.FILETIME filetime);
    
    
    }
    
    public class Program
    {
        public static void Main(string[] args)
        {
            System.Runtime.InteropServices.ComTypes.FILETIME ft;
            
            int iRet = NativeMethods.AcquireDeveloperLicense(IntPtr.Zero, out ft);
            long hFT2 = (((long)ft.dwHighDateTime) << 32) + ft.dwLowDateTime;
    
            DateTime dtExpiry = DateTime.FromFileTime(hFT2);
    
            Console.WriteLine("AcquireDeveloperLicense returned {0}, filetime is {1}", iRet, dtExpiry.ToString());
        }
    }
    
    }
    
    "@
    
    [AcquireDeveloper.Program]::Main($null)
    
    


     

     

     




    Monday, October 17, 2011 7:41 PM
    Owner

Answers

  • You need to allow PowerShell scripts to run on the system. To do that, first run an elevated PowerShell instance, then do the following:

     

    set-executionpolicy remotesigned

    or

    set-executionpolicy unrestricted

     

    The second one is more comprehensive, and thus potentially more dangerous, since it allows any PowerShell script full access to your system and could expose you to scripting attacks.

    To reset the policy, use

     

    set-executionpolicy restricted

    Friday, December 09, 2011 10:18 PM

All replies

  • The link target goes to Microsoft's internal mail server... the link text is correct though.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Friday, October 28, 2011 6:39 PM
  • Thanks for catching that.  Should be fixed now.
    Friday, October 28, 2011 7:03 PM
    Owner
  • I tried the exact same script on my developer desktop and a 32 bit tablet.

    On desktop it works fine.

    But, on tablet I am getting return code: 8019012E and file time: 12/31/1600

    As a result, I can not deploy custom apps to tablet.

     

    Can you please help?

    Tuesday, November 15, 2011 5:35 PM
  • Hi,

     I have VS11 developer preview already installed in my system, so  assumed it has developer license.

    When i tried installing the package i got error “Failed to install Developer Package”.

    So, When i tried the above script(by copying all the lines of code to test.ps1 file) to get developer license, i got error "Script execution not allowed,For details see execution policy"

    What is it stopping executing the script?

    Monday, November 28, 2011 7:51 AM
  • You need to allow PowerShell scripts to run on the system. To do that, first run an elevated PowerShell instance, then do the following:

     

    set-executionpolicy remotesigned

    or

    set-executionpolicy unrestricted

     

    The second one is more comprehensive, and thus potentially more dangerous, since it allows any PowerShell script full access to your system and could expose you to scripting attacks.

    To reset the policy, use

     

    set-executionpolicy restricted

    Friday, December 09, 2011 10:18 PM