匯出 (0) 列印
全部展開
EN
本內容沒有您的語言版本,但有英文版本。

Preparing company apps for distribution for Windows Phone

August 19, 2014

Before distributing a company app or a Company Hub app to employees or other users, you must prepare the app for distribution by performing the following tasks:

  • Precompile any managed assemblies that are included in the package into native code.

  • Sign the package with the enterprise certificate that you obtained from Symantec. For more info about obtaining the certificate, see Company app distribution for Windows Phone.

You can complete both tasks by running one of the PowerShell scripts that are included with the Windows Phone development tools. For more info, see Precompiling managed assemblies and signing apps by using the Windows PowerShell script in this topic.

For Windows Phone 8 apps, you also have the following options:

The Windows Phone development tools provide PowerShell scripts that call command-line tools to precompile and sign your app. These PowerShell scripts have the advantage of automating some tasks that you have to do manually when you call the individual tools directly. In most scenarios, consider using the PowerShell scripts unless you need other options provided by the individual tools.

For more info about Windows PowerShell, see Windows PowerShell.

Windows Phone 8 apps

Run the BuildMDILXap.ps1 script, which is in the %ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile folder.

The following table describes the arguments for the BuildMDILXap.ps1 script.

Argument

Description

-xapfilename XAP

(required)

The full path of the XAP file to precompile (and to sign, if the -pfxfilename option is specified).

-pfxfilename PFXFile

(optional)

Signs the XAP with the PFX file generated from the enterprise mobile code-signing certificate provided by Symantec. If the PFX file is not in the current path, specify the full path to the file.

-password Password

(optional)

The password to use to read the PFX file.

The following example demonstrates how to launch PowerShell and run the BuildMDILXap.ps1 script at the command prompt. Be sure to replace the file paths and password in this example with the relevant values.

powershell.exe -File "%ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\BuildMDILXap.ps1" -xapfilename "%UserProfile%\Documents\CompanyApps\Contoso.xap" –pfxfilename "%UserProfile%\Documents\Certificates\ContosoCert.pfx" -password mystrongpassword

Windows Phone 8.1 Silverlight apps

Run the BuildMDILSL81XAP.ps1 script, which is in the C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1\Tools\MDILXAPCompile folder.

All parameters for BuildMDILSL81XAP.ps1 are optional. To learn more about the parameters and to see sample scripts, open the BuildMDILSL81XAP.ps1 file in the editor.

  • If you simply run BuildMDILSL81XAP.ps1 without any arguments, the script prompts you to select a XAP package to optimize. The package is not signed.

  • If you typically use the script to sign packages with the same certificate path and the same password, modify the script to make those values the default values of the $pfxfilename and $password variables.

  • If you sign the package and provide a value for the optional –mailkeypath parameter, the script creates a draft Outlook email message that contains the optimized XAP package along with the associated .AETX file for distribution through email. The new mail message may open behind the active window.

The following example demonstrates how to launch PowerShell and run the BuildMDILSL81XAP.ps1 script at the command prompt. Be sure to replace the file paths and password in this example with the relevant values.

powershell.exe -File "%ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v8.1\Tools\MDILXAPCompile\BuildMDILSL81XAP.ps1" -xapfilename "%UserProfile%\Documents\CompanyApps\Contoso.xap" –pfxfilename "%UserProfile%\Documents\Certificates\ContosoCert.pfx" -password mystrongpassword

Windows Phone 8.1 Windows Runtime apps

Run the BuildMDILAPPX.ps1 script, which is in the C:\Program Files (x86)\Microsoft SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile folder.

All parameters for BuildMDILAPPX.ps1 are optional. To learn more about the parameters and to see sample scripts, open the BuildMDILAPPX.ps1 file in the editor.

  • If you simply run BuildMDILAPPX.ps1 without any arguments, the script prompts you to select an APPX package to optimize. The package is not signed.

  • If you typically use the script to sign packages with the same certificate path and the same password, modify the script to make those values the default values of the $pfxfilename and $password variables.

  • If you sign the package and provide a value for the optional –mailkeypath parameter, the script creates a draft Outlook email message that contains the optimized APPX package along with the associated .AETX file for distribution through email. The new mail message may open behind the active window.

The following example demonstrates how to launch PowerShell and run the BuildMDILAPPX.ps1 script at the command prompt. Be sure to replace the file paths and password in this example with the relevant values.

powershell.exe –File "%ProgramFiles(x86)%\Microsoft SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1" -appxfilename C:\temp\fabk.appx -pfxfilename C:\temp\cert01.pfx -password mypassword

You can also build Windows Phone 8 your app, precompile its assemblies, and sign it at the command prompt by using the MSBuild tool. You can build an app from a script or from a custom app by calling this tool.

Important noteImportant Note:

If you’re building apps with Visual Studio 2012, command-line precompilation and signing for Windows Phone 8 projects require Visual Studio 2012 Update 2 or later. The command-line properties described in this section are not included in the download of the Windows Phone SDK 8.0.

To precompile managed assemblies at the command prompt by using MSBuild

  • To precompile managed assemblies, use the MDILCompile command-line property with MSBuild.

    For example:

    msbuild /p:MDILCompile=true …
    

To sign the XAP at the command prompt by using MSBuild

  • To sign the XAP, use the SignXap command-line property with MSBuild.

    The SignXap property also requires values for the following two properties:

    • SignKeyFile: The fully qualified file name of the signing key.

    • SignKeyPassword: The password for the signing key file.

    For example:

    msbuild /p:SignXap=true /p:SignKeyFile=C:\MyFile\MyPvt.pfx /p:SignKeyPassword=abc%$^abc …
    

For more info about MSBuild, see MSBuild and MSBuild Reference.

顯示:
© 2014 Microsoft