AzureDevOps Pipeline - UWP - Error APPX0002: Task 'GenerateAppInstallerFile' failed. Input string was not in a correct format

Viewed 437

I have pipeline task whose YAML is as describe below:

steps:
- task: VSBuild@1
  displayName: 'Build solution **\*.sln'
  inputs:
    msbuildArgs: '/p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="$(appxPackageDir)"  /p:AppxBundle=Always  /p:UapAppxPackageBuildMode=SideLoadOnly  /p:AppxPackageSigningEnabled=true /p:PackageCertificateThumbprint="$(signingCert.thumbprint)" /p:PackageCertificateKeyFile="$(mySecureFile.secureFilePath)" /p:PackageCertificatePassword="$(signingCert.password)" /p:GenerateAppInstallerFile=true  /p:AppInstallerUri="$(AppInstallerUri)"  /p:AppInstallerUpdateFrequency=1 /p:AppInstallerCheckForUpdateFrequency=OnApplicationRun'
    platform: x64
    configuration: '$(buildConfiguration)'
    clean: true
    restoreNugetPackages: true
    msbuildArchitecture: x64
    createLogFile: true

Basically here I am trying to create appbundle and generate the appinstaller file so I can distribute the app using the link as the app is an internal app.

This was working till 14th May absolutely fine. However when we are running the pipeline again it give us below error. I am sure AzureDevOps build must have been definitely update something in there agent. But not able to figure out the actual issue.

##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Microsoft.AppXPackage.Targets(6361,5): Error APPX0002: Task 'GenerateAppInstallerFile' failed. Input string was not in a correct format.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Microsoft.AppXPackage.Targets(6361,5): error APPX0002: Task 'GenerateAppInstallerFile' failed. Input string was not in a correct format. [D:\a\1\s\Inspection.Management.UWP\Inspection.Management.UWP.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Microsoft.AppXPackage.Targets(6361,5): error APPX0002:  [D:\a\1\s\Inspection.Management.UWP\Inspection.Management.UWP.csproj]
##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Microsoft.AppXPackage.Targets(6361,5): Error MSB4018: The "GenerateAppInstallerFile" task failed unexpectedly.
System.FormatException: Input string was not in a correct format.
   at System.Text.StringBuilder.FormatError()

   at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
   at System.String.Format(String format, Object[] args)
   at Microsoft.Build.AppxPackage.AppxPackagingTaskHelper.LogError(String context, String fileName, Int32 lineNumber, Int32 columnNumber, String message, Tuple`2 callerInfo, Object[] messageArgs)
   at Microsoft.Build.AppxPackage.AppxPackagingTaskHelper.LogError(String message, String callerMemberName, Int32 callerLineNumber, Object[] messageArgs)
   at Microsoft.Build.AppxPackage.GenerateAppInstallerFile.ExecuteImplementation()
   at Microsoft.Build.AppxPackage.AppxPackagingTaskHelper.Execute(String file)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Build.AppxPackage.AppxPackagingTaskHelper.Execute(String file)
   at Microsoft.Build.AppxPackage.AppxPackagingTaskBase.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

Has any face this issue?

1 Answers

Same problem here.

This works if we disable GenerateAppInstallerFile by setting it to false in the MSBuild Arguments as follows.

/p:GenerateAppInstallerFile=False

This is needed only if we need to publish our app to a Web server, then we need to tell MSBuild to generate a versioned .appinstaller file. Otherwise, for my case, I don't need it so I simply set it to false and the pipeline works now.

Related