0
votes

I am trying to setup continuous deployment for my Windows Phone 8.1 (Windows Phone RT) application. The client bought Symantec certificate which we will use for signing the app. First, I've tried to do everything on my local machine:

  • Install TFS2015 (which we plan to use for getting the code from repository, building the app and signing it)
  • Install HockeyApp (which we will use for deployment) addon for TFS

I have setup the build steps in following order:

  1. NuGet Installer,
  2. Visual Studio Build,
  3. Index Sources & Publish Symbols
  4. Publish Build Artifact
  5. Command Line (powershell.exe -ExecutionPolicy Unrestricted -File "c:\program files (x86)\Microsoft SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1" -appxfilename "AppxPath.appx" -pfxfilename "SymantecCertPath.pfx" -password XXXX -inputFolder "someFolder\input" -outputfolder "someFOlder\output" -silent yes)
  6. Copy Files (coping sign appx file, appxsym and AETX file in one folder)
  7. Command Line (powershell.exe -ExecutionPolicy Unrestricted -File "ZipAppxUpload.ps1" -folderpath "FolderWhereAppxAndPfxFileAre" -appxuploadname "MyAppName.appxupload") - zipping the appx, appxsym and aetx file in .appupload file
  8. HockeyApp - deploy .appupload to HockeyApp

I had to sign app manually (cmd) since I couldnt sign it via Visual Studio Community 2015 (error: An attempt was made to to reference a token that doesn't exist.). I couldn't resolve it. Manual signing is successful.

The process that I described is successful on my local machine (Windows 10 Pro). However, the request is that we install that process on the remote Windows Server 2012 R2.

I've install the same version of TFS and Visual Studio on it, and copied the process that I already have on my machine (with necessary path changes).

I get an error on the fifth TFS build step.

2016-09-23T07:41:32.4673974Z ##[error]Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
2016-09-23T07:41:32.4673974Z ##[error]At C:\program files (x86)\Microsoft SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1:295 char:15
2016-09-23T07:41:32.4673974Z ##[error]+ ...   $result = Start-Process -FilePath $executable -ArgumentList "$Argum ...
2016-09-23T07:41:32.4673974Z ##[error]+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2016-09-23T07:41:32.4673974Z ##[error]    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
2016-09-23T07:41:32.4673974Z ##[error]    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
2016-09-23T07:41:32.4673974Z ##[error] 
2016-09-23T07:41:32.4673974Z ##[error]breakt : The term 'breakt' is not recognized as the name of a cmdlet, function, script file, or operable program. 
2016-09-23T07:41:32.4673974Z ##[error]Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
2016-09-23T07:41:32.4830227Z ##[error]At C:\program files (x86)\Microsoft SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1:300 char:8
2016-09-23T07:41:32.4830227Z ##[error]+        breakt
2016-09-23T07:41:32.4830227Z ##[error]+        ~~~~~~
2016-09-23T07:41:32.4830227Z ##[error]    + CategoryInfo          : ObjectNotFound: (breakt:String) [], CommandNotFoundException
2016-09-23T07:41:32.4830227Z ##[error]    + FullyQualifiedErrorId : CommandNotFoundException
2016-09-23T07:41:32.4830227Z ##[error] 
2016-09-23T07:41:33.5767751Z ##[error]Get-Content : Cannot find path 'D:\...\AppxManifest.xml' because it does 
2016-09-23T07:41:33.5767751Z ##[error]not exist.
2016-09-23T07:41:33.5767751Z ##[error]At C:\program files (x86)\Microsoft SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1:464 char:31
2016-09-23T07:41:33.5767751Z ##[error]+     [xml]$Manifestxml = [xml](Get-Content "$appxmanifestpath" )
2016-09-23T07:41:33.5767751Z ##[error]+                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2016-09-23T07:41:33.5767751Z ##[error]    + CategoryInfo          : ObjectNotFound: (D:\...ppxManifest.xml:String) [Get-Content], ItemNotFoundEx 
2016-09-23T07:41:33.5767751Z ##[error]   ception
2016-09-23T07:41:33.5767751Z ##[error]    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
2016-09-23T07:41:33.5767751Z ##[error] 
2016-09-23T07:41:33.5767751Z ##[error]You cannot call a method on a null-valued expression.
2016-09-23T07:41:33.5767751Z ##[error]At C:\program files (x86)\Microsoft SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1:466 char:5
2016-09-23T07:41:33.5767751Z ##[error]+     $Manifestxml.$node.Identity.SetAttribute("Publisher", "$pfxsubjec ...
2016-09-23T07:41:33.5767751Z ##[error]+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2016-09-23T07:41:33.5767751Z ##[error]    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
2016-09-23T07:41:33.5767751Z ##[error]    + FullyQualifiedErrorId : InvokeMethodOnNull
2016-09-23T07:41:33.5767751Z ##[error] 
2016-09-23T07:41:33.5767751Z ##[error]You cannot call a method on a null-valued expression.
2016-09-23T07:41:33.5767751Z ##[error]At C:\program files (x86)\Microsoft SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1:467 char:5
2016-09-23T07:41:33.5767751Z ##[error]+     $Manifestxml.Save("$appxmanifestpath")
2016-09-23T07:41:33.5924006Z ##[error]+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2016-09-23T07:41:33.5924006Z ##[error]    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
2016-09-23T07:41:33.5924006Z ##[error]    + FullyQualifiedErrorId : InvokeMethodOnNull
2016-09-23T07:41:33.5924006Z ##[error] 
2016-09-23T07:41:33.5924006Z ##[error]Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
2016-09-23T07:41:33.5924006Z ##[error]At C:\program files (x86)\Microsoft SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1:345 char:15
2016-09-23T07:41:33.5924006Z ##[error]+ ...   $result = Start-Process -FilePath $executable -ArgumentList $Argume ...
2016-09-23T07:41:33.5924006Z ##[error]+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2016-09-23T07:41:33.5924006Z ##[error]    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
2016-09-23T07:41:33.5924006Z ##[error]    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
2016-09-23T07:41:33.5924006Z ##[error] 
2016-09-23T07:41:33.5924006Z ##[error]Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
2016-09-23T07:41:33.5924006Z ##[error]At C:\program files (x86)\Microsoft SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1:430 char:15
2016-09-23T07:41:33.5924006Z ##[error]+ ...   $result = Start-Process -FilePath $executable -ArgumentList $Argume ...
2016-09-23T07:41:33.5924006Z ##[error]+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2016-09-23T07:41:33.5924006Z ##[error]    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
2016-09-23T07:41:33.5924006Z ##[error]    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
2016-09-23T07:41:33.5924006Z ##[error] 
2016-09-23T07:41:33.6548990Z ##[error]Process completed with exit code 0 and had 3 error(s) written to the error stream.

When I try to sign the app on Windows Server via cmd (as admin) with:

powershell.exe -ExecutionPolicy Unrestricted -File "c:\program files (x86)\Microsoft SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1" -appxfilename "AppxPath.appx" -pfxfilename "SymantecCertPath.pfx" -password XXXX -inputFolder "someFolder\input" -outputfolder "someFOlder\output" -silent yes

I get the same error:

Start-Process : This command cannot be run due to the error: The system cannot
find the file specified.
At C:\program files (x86)\Microsoft
SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1:295 char:15
+ ...   $result = Start-Process -FilePath $executable -ArgumentList "$Argum ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOp
   erationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.C
   ommands.StartProcessCommand

breakt : The term 'breakt' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At C:\program files (x86)\Microsoft
SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1:300 char:8
+        breakt
+        ~~~~~~
    + CategoryInfo          : ObjectNotFound: (breakt:String) [], CommandNotFo
   undException
    + FullyQualifiedErrorId : CommandNotFoundException





Get-Content : Cannot find path
'D:\...\AppxManifest.xml'
because it does not exist.
At C:\program files (x86)\Microsoft
SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1:464 char:31
+     [xml]$Manifestxml = [xml](Get-Content "$appxmanifestpath" )
+                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:\...ppxManifest.x
   ml:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetCo
   ntentCommand

You cannot call a method on a null-valued expression.
At C:\program files (x86)\Microsoft
SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1:466 char:5
+     $Manifestxml.$node.Identity.SetAttribute("Publisher", "$pfxsubjec ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\program files (x86)\Microsoft
SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1:467 char:5
+     $Manifestxml.Save("$appxmanifestpath")
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull



Start-Process : This command cannot be run due to the error: The system cannot
find the file specified.
At C:\program files (x86)\Microsoft
SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1:345 char:15
+ ...   $result = Start-Process -FilePath $executable -ArgumentList $Argume ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOp
   erationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.C
   ommands.StartProcessCommand



Start-Process : This command cannot be run due to the error: The system cannot
find the file specified.
At C:\program files (x86)\Microsoft
SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1:430 char:15
+ ...   $result = Start-Process -FilePath $executable -ArgumentList $Argume ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOp
   erationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.C
   ommands.StartProcessCommand

I've got Powershell version 5.1 on my local machine, and Powershell version 5.0 on Windows Server.

What am I doing wrong here during signing? The process is completely copied from my machine to remote Windows Server. Any help is appreciated.

1
Do you mean when you install TFS on Windows 10 Pro, you'll get successful build? When you install TFS Windows Server 2012 R2, you won't get successful build? Where did you deploy your build agent?Cece Dong - MSFT
"Do you mean when you install TFS on Windows 10 Pro, you'll get successful build? When you install TFS Windows Server 2012 R2, you won't get successful build?" - That is correct "Where did you deploy your build agent?" For my local machine (Win10 Pro), agent is downloaded, configured and run from my local hard drive location. For remote Windows Server, agent is (also) downloaded, configured and run on Windows Server machine's local hard drive.Slavisa
What else can I check? I am still looking for anything that might be wrong here.Slavisa

1 Answers

0
votes

As your issue occurs on Step5, you need to check on your build agent machine, to see whether you can find file in c:\program files (x86)\Microsoft SDKs\WindowsPhoneApp\v8.1\Tools\MDILXAPCompile\BuildMDILAPPX.ps1. Also, check whether you have installed windows phone SDK on your build agent machine.