问题
I'm trying to deploy a appx package from C# to a Windows Phone Emulator as seen here:
How to deploy an .appx into Windows Phone 8.1
The thing is that the method GetDevices()
returns a list of devices like this:
- {Device}
- {Emulator 8.1 WVGA 4 inch 512MB(ES)}
- {Emulator 8.1 WVGA 4 inch(ES)}
- {Emulator 8.1 720P 4.7 inch(ES)}
I don't know why it appends the (ES) at the end. After i execute the code, the Emulator launches but it gets stuck. It does not work.
Can i instead, have a already running Emulator and choose that one?
回答1:
Let's try. but first...
PRE REQUIREMENTS
- Windows 8.1+ as Operating System
- Windows Phone SDK 8.1 installed
I did create a batch script file (.bat) to execute all steps required. Now I'm having some throubles to deploy the App. But it can be a starting point.
The script is following:
@echo off
REM SOURCES
REM ------------------------------------------------------------------------------
REM Create a Windows Store AppX package and sign it
REM http://blogs.msdn.com/b/wsdevsol/archive/2014/02/12/create-a-windows-store-appx-package-and-sign-it.aspx
REM How to create an app package signing certificate
REM https://msdn.microsoft.com/pt-br/library/windows/desktop/jj835832(v=vs.85).aspx
REM How to sign an app package using SignTool
REM https://msdn.microsoft.com/pt-br/library/windows/desktop/jj835835(v=vs.85).aspx
REM ------------------------------------------------------------------------------
SET "WINDOWS_KIT_8_1_86X=%PROGRAMFILES(x86)%\Windows Kits\8.1\bin\x86\"
SET makeappxexe = "%PROGRAMFILES(x86)%\Windows Kits\8.1\bin\x86\makeappx.exe"
SET msbuildexe = "%PROGRAMFILES(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
SET "APP_DIRECTORY=%userprofile%\source\repos\MyAwesomeApp\App1"
SET "APP_PACKAGE_DIRECTORY=%userprofile%\source\repos\MyAwesomeApp\App1\AppPackages\"
@echo "building App1 project..."
%msbuildexe% "%APP_DIRECTORY%App1.csproj" /verbosity:quiet
REM App packager(MakeAppx.exe)
REM https://msdn.microsoft.com/en-us/library/windows/desktop/hh446767(v=vs.85).aspx
@echo "Creating APPX from App1 project..."
%makeappxexe% pack /o /v /l /d "%APP_DIRECTORY%" /p "%APP_PACKAGE_DIRECTORY%App1.appx"
REM MakeCert
REM https://msdn.microsoft.com/pt-br/library/windows/desktop/ff548309(v=vs.85).aspx
@echo "Making certificate..."
"%WINDOWS_KIT_8_1_86X%makecert.exe" /n "[PACKAGE.IDENTITY.PUBLISHER] LOCATED AT APPXMANIFEX.XML OR PACKAGE.APPXMANIFEST" /r /h 0 /eku "1.3.6.1.5.5.7.3.3,1.3.6.1.4.1.311.10.3.13" /e "12/30/2016" /sv "%APP_PACKAGE_DIRECTORY%Appp1Key.pvk" "%APP_PACKAGE_DIRECTORY%Appp1Key.cer"
REM Pvk2Pfx
REM https://msdn.microsoft.com/pt-br/library/windows/desktop/ff550672(v=vs.85).aspx
@echo "Making PFX file..."
"%WINDOWS_KIT_8_1_86X%Pvk2Pfx.exe" /f /pvk "%APP_PACKAGE_DIRECTORY%Appp1Key.pvk" /spc "%APP_PACKAGE_DIRECTORY%Appp1Key.cer" /pfx "%APP_PACKAGE_DIRECTORY%Appp1Key.pfx"
REM SignTool
REM https://msdn.microsoft.com/pt-br/library/windows/desktop/ff551778(v=vs.85).aspx
@echo "Signing APPX..."
"%WINDOWS_KIT_8_1_86X%SignTool.exe" sign /fd SHA256 /a /f "%APP_PACKAGE_DIRECTORY%Appp1Key.pfx" "%APP_PACKAGE_DIRECTORY%App1.appx"
REM Deploy Windows Phone 8.1 apps with the Application Deployment tool
REM https://msdn.microsoft.com/en-us/library/dn632395.aspx
@echo "Deploying App1 to emulator..."
"C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1\Tools\AppDeploy\AppDeployCmd.exe" /installlaunch "%APP_PACKAGE_DIRECTORY%App1.appx" /targetdevice:6
@echo "Deploying App1 to device..."
"C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1\Tools\AppDeploy\AppDeployCmd.exe" /installlaunch "%APP_PACKAGE_DIRECTORY%App1.appx" /targetdevice:de
You can also build the your Project (it will generate an Appx automatically) and use autogenerated Appx to deploy to emulator or device as follows:
SET "APP_DIRECTORY=%userprofile%\source\repos\MyAwesomeApp\App1"
SET "APPX_PATH=%userprofile%\source\repos\MyAwesomeApp\App1\AppPackages\App1_1.0.0.0_x86_Test\App1_1.0.0.0_x86.appx"
@echo "building App1 project..."
"%PROGRAMFILES(x86)%\MSBuild\14.0\Bin\MSBuild.exe" "%APP_DIRECTORY%\App1.csproj" -t:Rebuild -p:Configuration=Release;BuildPlatform=x86 /verbosity:minimal /nologo
REM Deploy Windows Phone 8.1 apps with the Application Deployment tool
REM https://msdn.microsoft.com/en-us/library/dn632395.aspx
@echo "Deploying App1 to emulator..."
"C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1\Tools\AppDeploy\AppDeployCmd.exe" /installlaunch "%APPX_PATH%" /targetdevice:6
@echo "Deploying App1 to device..."
"C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1\Tools\AppDeploy\AppDeployCmd.exe" /installlaunch "%APPX_PATH%" /targetdevice:de
I hope it helps you, but if you already have found the solution, please, let me know.
回答2:
you can try using Application Deployment Tools ( XapDeploy.exe ) , for more information you can follow this link : https://msdn.microsoft.com/en-us/library/windows/apps/ff402565(v=vs.105).aspx
Step by Step :
- You can also use the Windows Phone Application Deployment tool (XapDeploy.exe) to deploy your app. This tool is a stand-alone app that is installed when you install the Windows Phone SDK.
- You can use the version of the Application Deployment tool installed in the folder C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\XAP Deployment to deploy apps that target Windows Phone OS 8.0 or Windows Phone OS 7.1. You can only use the version of the Application Deployment tool installed in the folder C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.1\Tools\XAP Deployment to deploy apps that target Windows Phone OS 7.1.
- To deploy an app with the Application Deployment tool
- Build your app.
- If you’re deploying your app to a connected device, make sure that you have completed the prerequisites listed earlier in this topic. From the Windows Start screen, launch the Application Deployment tool. You can find the Application Deployment tool by opening All apps view and locating it in the Windows Phone SDK 8.0 group, or by typing Application Deployment from the Start screen to search for it.
- You can also run the tool from the following location: C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\XAP Deployment\XapDeploy.exe
- In the Target drop-down box, select one of the emulator options.
- Click Browse and locate the XAP file that you want deploy.
- Click Deploy.
- If the deployment is successful, the Status field displays XAP Deployment Complete.
来源:https://stackoverflow.com/questions/29756989/how-to-deploy-appx-to-running-windows-phone-emulator