问题描述
我正在尝试从C#部署一个 appx 包到Windows Phone仿真器,如下所示:
I'm trying to deploy a appx package from C# to a Windows Phone Emulator as seen here:
事情是方法 GetDevices()
返回一个这样的设备列表:
The thing is that the method GetDevices()
returns a list of devices like this:
- {Device}
- {模拟器8.1 WVGA 4英寸512MB(ES)}
- {模拟器8.1 WVGA 4英寸(ES)}
- {模拟器8.1 720P 4.7英寸(ES)}
- {Device}
- {Emulator 8.1 WVGA 4 inch 512MB(ES)}
- {Emulator 8.1 WVGA 4 inch(ES)}
- {Emulator 8.1 720P 4.7 inch(ES)}
我不知道为什么它会追加(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?
推荐答案
我们来试试
但首先...
Let's try.but first...
- Windows 8.1 +作为操作系统
- 安装Windows Phone SDK 8.1
我创建了一个批处理脚本文件(.bat)执行所需的所有步骤。
现在我有一些麻烦来部署应用程序。但是这可能是一个起点。
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.
脚本如下:
@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
您还可以构建您的项目(将自动生成Appx),并使用自动生成的Appx部署到仿真器或设备,如下所示:
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.
这篇关于如何将APPX部署到运行Windows Phone Emulator?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!