UWP 项目在 GitHub 操作上失败,因为证书无效 APPX0107
UWP project failed on GitHub Actions because certificate is invalid APPX0107
ITNOA
我在 GitHub 中有一个项目,在 here 中有一个 UWP 项目。
我想为这个项目设置 GitHub 操作 this main.yml configuration
当 GitHub Actions 想要使用以下命令构建我的解决方案时
- name: Library build
run: |
cd src
nuget restore
msbuild PCLAppConfig.sln /verbosity:normal /t:Rebuild /p:Configuration=Release
我在 UWP 构建中看到以下错误的失败错误
2020-03-23T13:07:20.1871936Z "D:\a\PCLAppConfig\PCLAppConfig\src\PCLAppConfig.sln" (Rebuild target) (1) ->
2020-03-23T13:07:20.1872322Z "D:\a\PCLAppConfig\PCLAppConfig\src\DemoApp\DemoApp.UWP\DemoApp.UWP.csproj" (Rebuild target) (10) ->
2020-03-23T13:07:20.1872524Z (_GenerateCurrentProjectAppxManifest target) ->
2020-03-23T13:07:20.1872807Z C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Microsoft.AppXPackage.Targets(2650,5): warning APPX0107: The certificate specified is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478. [D:\a\PCLAppConfig\PCLAppConfig\src\DemoApp\DemoApp.UWP\DemoApp.UWP.csproj]
2020-03-23T13:07:20.1873172Z
2020-03-23T13:07:20.1873447Z
2020-03-23T13:07:20.1873657Z "D:\a\PCLAppConfig\PCLAppConfig\src\PCLAppConfig.sln" (Rebuild target) (1) ->
2020-03-23T13:07:20.1873802Z "D:\a\PCLAppConfig\PCLAppConfig\src\DemoApp\DemoApp.UWP\DemoApp.UWP.csproj" (Rebuild target) (10) ->
2020-03-23T13:07:20.1873935Z (_GenerateAppxPackageFile target) ->
2020-03-23T13:07:20.1874153Z C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Microsoft.AppXPackage.Targets(3402,5): error APPX0107: The certificate specified is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478. [D:\a\PCLAppConfig\PCLAppConfig\src\DemoApp\DemoApp.UWP\DemoApp.UWP.csproj]
2020-03-23T13:07:20.1874919Z
2020-03-23T13:07:20.1875022Z 4 Warning(s)
2020-03-23T13:07:20.1875125Z 1 Error(s)
2020-03-23T13:07:20.1875697Z
2020-03-23T13:07:20.1875988Z Time Elapsed 00:03:28.50
2020-03-23T13:07:20.6575030Z ##[error]Process completed with exit code 1.
注意如果我运行 msbuild PCLAppConfig.sln /verbosity:normal /t:Rebuild /p:Configuration=Release
在本地计算机上,构建成功并且没有任何错误,我可以在本地运行 UWP 应用程序。
我的问题是我的问题是什么?我该如何解决?
谢谢
您应该设置 PackageCertificateKeyFile 并确保文件推送到 GitHub。并且您应该将密码添加到您的 pfx 文件中。
/p:PackageCertificateKeyFile=Package_TemporaryKey.pfx /p:PackageCertificatePassword="123"
请替换 Package_TemporaryKey.pfx
和密码。
如果您不想将 pfx 文件推送到 GitHub,您可以使用 github secrets
首先是将 pfx 文件解析为 base64 字符串。
第二个是将 pfx 文件 base64 字符串设置为 github secrets。
然后您可以在开始构建之前使用此 base64 字符串。
Decode the Base64 encoded Pfx
- name: Decode the Pfx
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
$currentDirectory = Get-Location
$certificatePath = Join-Path -Path $currentDirectory -ChildPath $env:Wap_Project_Directory -AdditionalChildPath $env:SigningCertificate
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
您可以在 github
中找到我的示例代码
编辑
我阅读了您的代码并找到了 DemoApp.UWP_TemporaryKey.pfx
和 Windows_TemporaryKey.pfx
文件。因为我的网速很差,能不能把你的代码用git clean -xdf
清理一下,然后用命令行在本地编译?也许您应该明确指定要使用的文件。
ITNOA
我在 GitHub 中有一个项目,在 here 中有一个 UWP 项目。
我想为这个项目设置 GitHub 操作 this main.yml configuration
当 GitHub Actions 想要使用以下命令构建我的解决方案时
- name: Library build
run: |
cd src
nuget restore
msbuild PCLAppConfig.sln /verbosity:normal /t:Rebuild /p:Configuration=Release
我在 UWP 构建中看到以下错误的失败错误
2020-03-23T13:07:20.1871936Z "D:\a\PCLAppConfig\PCLAppConfig\src\PCLAppConfig.sln" (Rebuild target) (1) ->
2020-03-23T13:07:20.1872322Z "D:\a\PCLAppConfig\PCLAppConfig\src\DemoApp\DemoApp.UWP\DemoApp.UWP.csproj" (Rebuild target) (10) ->
2020-03-23T13:07:20.1872524Z (_GenerateCurrentProjectAppxManifest target) ->
2020-03-23T13:07:20.1872807Z C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Microsoft.AppXPackage.Targets(2650,5): warning APPX0107: The certificate specified is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478. [D:\a\PCLAppConfig\PCLAppConfig\src\DemoApp\DemoApp.UWP\DemoApp.UWP.csproj]
2020-03-23T13:07:20.1873172Z
2020-03-23T13:07:20.1873447Z
2020-03-23T13:07:20.1873657Z "D:\a\PCLAppConfig\PCLAppConfig\src\PCLAppConfig.sln" (Rebuild target) (1) ->
2020-03-23T13:07:20.1873802Z "D:\a\PCLAppConfig\PCLAppConfig\src\DemoApp\DemoApp.UWP\DemoApp.UWP.csproj" (Rebuild target) (10) ->
2020-03-23T13:07:20.1873935Z (_GenerateAppxPackageFile target) ->
2020-03-23T13:07:20.1874153Z C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Microsoft.AppXPackage.Targets(3402,5): error APPX0107: The certificate specified is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478. [D:\a\PCLAppConfig\PCLAppConfig\src\DemoApp\DemoApp.UWP\DemoApp.UWP.csproj]
2020-03-23T13:07:20.1874919Z
2020-03-23T13:07:20.1875022Z 4 Warning(s)
2020-03-23T13:07:20.1875125Z 1 Error(s)
2020-03-23T13:07:20.1875697Z
2020-03-23T13:07:20.1875988Z Time Elapsed 00:03:28.50
2020-03-23T13:07:20.6575030Z ##[error]Process completed with exit code 1.
注意如果我运行 msbuild PCLAppConfig.sln /verbosity:normal /t:Rebuild /p:Configuration=Release
在本地计算机上,构建成功并且没有任何错误,我可以在本地运行 UWP 应用程序。
我的问题是我的问题是什么?我该如何解决?
谢谢
您应该设置 PackageCertificateKeyFile 并确保文件推送到 GitHub。并且您应该将密码添加到您的 pfx 文件中。
/p:PackageCertificateKeyFile=Package_TemporaryKey.pfx /p:PackageCertificatePassword="123"
请替换 Package_TemporaryKey.pfx
和密码。
如果您不想将 pfx 文件推送到 GitHub,您可以使用 github secrets
首先是将 pfx 文件解析为 base64 字符串。
第二个是将 pfx 文件 base64 字符串设置为 github secrets。
然后您可以在开始构建之前使用此 base64 字符串。
Decode the Base64 encoded Pfx
- name: Decode the Pfx
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
$currentDirectory = Get-Location
$certificatePath = Join-Path -Path $currentDirectory -ChildPath $env:Wap_Project_Directory -AdditionalChildPath $env:SigningCertificate
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
您可以在 github
中找到我的示例代码编辑
我阅读了您的代码并找到了 DemoApp.UWP_TemporaryKey.pfx
和 Windows_TemporaryKey.pfx
文件。因为我的网速很差,能不能把你的代码用git clean -xdf
清理一下,然后用命令行在本地编译?也许您应该明确指定要使用的文件。