我正在尝试将C#中的 appx 软件包部署到Windows Phone模拟器,如下所示:
How to deploy an .appx into Windows Phone 8.1
问题是方法GetDevices()
返回这样的设备列表:
我不知道为什么它会在最后添加(ES)。 执行代码后,模拟器启动但卡住了。它不起作用。
我可以改为使用已经运行的模拟器并选择那个吗?
答案 0 :(得分:2)
试试吧。 但首先......
我确实创建了一个批处理脚本文件(.bat)来执行所需的所有步骤。 现在我有一些部署应用程序的麻烦。但它可以作为一个起点。
脚本如下:
@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按如下方式部署到模拟器或设备:
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
我希望它对您有所帮助,但如果您已找到解决方案,请告诉我。
答案 1 :(得分:1)
您可以尝试使用应用程序部署工具(XapDeploy.exe),有关详细信息,请访问以下链接:https://msdn.microsoft.com/en-us/library/windows/apps/ff402565(v=vs.105).aspx
一步一步: