Testing apps
Monkey Targets Forums/Windows 8/Testing apps
| ||
| It's a bit weird that you need to open VS in order to test Win 8 apps. Has anyone find a way to prevent this? |
| ||
| Yeah while exporting my game to win8 i figured this out. Only mark could tell us if this is normal. Btw thanks for opening the win8 forum! |
| ||
| Ok, I had a look at this and got it somewhat working http://blogs.msdn.com/b/windowsappdev/archive/2012/09/04/automating-the-testing-of-windows-8-apps.aspx and http://stackoverflow.com/questions/14271025/can-i-run-my-winrt-application-as-a-screensaver Here are the steps to run without opening visual studio: 1. Compile a Win8AppLaunch.exe file like the articles says. (I called my runapp.exe) Finally I made a .bat file that looks like this to run angelfont_example: powershell.exe Set-ExecutionPolicy AllSigned powershell.exe Remove-AppxPackage acbdc544-1702-440e-82d9-0495d7c2c2e9_1.0.0.0_x86__73zwdfx56gv16 powershell.exe D:\dev\Monkey\Monkeypro\bananas\beaker\angelfont_example\angelfont_example.build\win8\AppPackages\MonkeyGame\MonkeyGame_1.0.0.0_Win32_Debug_Test\Add-AppDevPackage.ps1 d:\dev\monkey\monkeypro\runapp acbdc544-1702-440e-82d9-0495d7c2c2e9_73zwdfx56gv16!App If this is run after compiling from monkey, the win8 app should start. "acbdc544-1702-440e-82d9-0495d7c2c2e9_73zwdfx56gv16!App" is the appid, I don't think this changes, but if it does you can find it by running the following ps script as the stackoverflow answer says. $installedapps = get-AppxPackage foreach ($app in $installedapps) { foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id) { $app.packagefamilyname + "!" + $id } } |
| ||
| I don't mind opening VS. I downloaded the express version for free. You can edit the manifest file with their nice little editor, specify your icons, file name etc... |
| ||
| Still not sure about the APPIDs, but this modified transcc works on my machine: \src\transcc\builders\win8.monkey line 62
If tcc.opt_run
Local APPID := "acbdc544-1702-440e-82d9-0495d7c2c2e9_73zwdfx56gv16!App"
Local APPID2 := "acbdc544-1702-440e-82d9-0495d7c2c2e9_1.0.0.0_x86__73zwdfx56gv16"
Local targetPath := StripExt( tcc.opt_srcpath )+".build" +"/"+tcc.target.dir
Local pspath := targetPath+ "/AppPackages/MonkeyGame/MonkeyGame_1.0.0.0_Win32"
If ENV_CONFIG.ToLower() = "debug" Then
pspath += "_Debug"
End
pspath += "_Test"
tcc.Execute( "powershell.exe Remove-AppxPackage "+APPID2, False)
tcc.Execute( "powershell.exe "+pspath+"/Add-AppDevPackage.ps1 -Force", False)
tcc.Execute(tcc.monkeydir+"/runapp "+APPID)
Endif
runapp is an .exe file compiled with Visual Studio as a C++ Win32 Console Application
#include "stdafx.h"
#include <shlobj.h>
#include <stdio.h>
#include <shobjidl.h>
#include <objbase.h>
#include <atlbase.h>
#include <string>
/*++
Routine Description:
This routine launches your app using IApplicationActivationManager.
Arguments:
strAppUserModelID - AppUserModelID of the app to launch.
pdwProcessId - Output argument that receives the process id of the launched app.
Return value:
HRESULT indicating success/failure
--*/
HRESULT LaunchApp(const std::wstring& strAppUserModelId, PDWORD pdwProcessId)
{
CComPtr<IApplicationActivationManager> spAppActivationManager;
HRESULT hrResult = E_INVALIDARG;
if (!strAppUserModelId.empty())
{
// Instantiate IApplicationActivationManager
hrResult = CoCreateInstance(CLSID_ApplicationActivationManager,
NULL,
CLSCTX_LOCAL_SERVER,
IID_IApplicationActivationManager,
(LPVOID*)&spAppActivationManager);
if (SUCCEEDED(hrResult))
{
// This call ensures that the app is launched as the foreground window
hrResult = CoAllowSetForegroundWindow(spAppActivationManager, NULL);
// Launch the app
if (SUCCEEDED(hrResult))
{
hrResult = spAppActivationManager->ActivateApplication(strAppUserModelId.c_str(),
NULL,
AO_NONE,
pdwProcessId);
}
}
}
return hrResult;
}
int _tmain(int argc, _TCHAR* argv[])
{
HRESULT hrResult = S_OK;
if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
{
if (argc == 2)
{
DWORD dwProcessId = 0;
++argv;
hrResult = LaunchApp(*argv, &dwProcessId);
}
else
{
hrResult = E_INVALIDARG;
}
CoUninitialize();
}
return hrResult;
}
and you must have run the powershell command Set-ExecutionPolicy AllSigned |