Validating an app package in automated builds (Windows Store apps)
By validating an app whenever you build it, you can help ensure that it will pass the validation tests that Windows Store requires when you publish an app. If you're using Team Foundation Build, you can update the project files and modify settings on the build machine so that the validation tests in the Windows App Certification Kit (ACK) run automatically. In addition, you don’t need to change any build definitions.
To integrate Windows ACK validation with Team Foundation Build
Unload the project file to make it editable.
Copy the following PostPackageEvent target, and then paste it near the end of the file, next to the pre-build and post-build targets.
<Target Name="PostPackageEvent" AfterTargets="_GenerateAppxPackage"> <Exec Command=""$(TargetPlatformSdkPath)App Certification Kit\appcert.exe" reset"/> <Exec Command=""$(TargetPlatformSdkPath)\App Certification Kit\appcert.exe" test -apptype windowsstoreapp -AppxPackagePath "$(FinalAppxPackage)" –reportoutputpath "$(outdir)\ValidationResult.xml"" /> <Exec Command="copy "$(userprofile)\appdata\Local\Microsoft\appcertkit\ValidationResult.htm" "$(outdir)\ValidationResult.htm""/> </Target>
The output file, ValidationResult.xml, will be written to the path in –reportoutputpath. If you specify a static location rather than $(outdir), ensure that the directory exists before you queue the build, and delete the output file before you queue the build again.
On the build machine, open the Team Foundation Server Administration Console.
On the Build Configuration page, choose the Build Service Properties link.
The Build Service Properties dialog box opens.
In the Run the service as text box, specify an account that has administrator permissions on the build machine, and then select the Run the Service Interactively check box.
If you select that check box, the build service can launch other apps as needed.
When you start the build service on the build machine, run %ProgramFiles%\Microsoft Team Foundation Server 11.0\Tools\TFSBuildServiceHost.exe with administrative permissions.
Queue the build.
When the build finishes, review the test results in the ValidationResult.htm file. The test results appear in the last entry of the PostPackageEvent target that you previously pasted into the ValidationResult.htm file.
The build doesn’t pass or fail based on the result of the validation. You must view the test results to know whether the app has validation errors.