首页 > 解决方案 > AzureDevOps 管道 - UWP - 错误 APPX0002:任务“GenerateAppInstallerFile”失败。输入字符串的格式不正确

问题描述

我有管道任务,其 YAML 如下所述:

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

基本上,我在这里尝试创建 appbundle 并生成 appinstaller 文件,以便我可以使用链接分发应用程序,因为该应用程序是一个内部应用程序。

这一直工作到 5 月 14 日,绝对没问题。但是,当我们再次运行管道时,它会给我们以下错误。我确信 AzureDevOps 构建肯定已经在代理中更新了一些东西。但无法弄清楚实际问题。

##[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()

有没有人面对这个问题?

标签: azure-devopsazure-pipelines

解决方案


这里同样的问题。

如果我们通过在 MSBuild Arguments 中将 GenerateAppInstallerFile 设置为 false 来禁用它,这将起作用,如下所示。

/p:GenerateAppInstallerFile=False

仅当我们需要将应用程序发布到 Web 服务器时才需要这样做,然后我们需要告诉 MSBuild 生成版本化的 .appinstaller 文件。否则,就我而言,我不需要它,所以我只需将其设置为 false,管道现在就可以工作了。


推荐阅读