我在内部托管的 AzureDevOps 2019 服务器上配置了 UWP CI,但它失败并出现以下错误。我已将此作为指南。有人可以指导我走向成功吗?
配置后YAML如下:
资源:- repo:自我队列:名称:默认要求:- msbuild - visualstudio
您的构建管道引用了一个名为“Parameters.solution”的未定义变量。为此 YAML 文件创建或编辑构建管道,在“变量”选项卡上定义变量。请参阅https://go.microsoft.com/fwlink/?linkid=865972 您的构建管道引用了一个名为“Parameters.secureFile”的未定义变量。为此 YAML 文件创建或编辑构建管道,在“变量”选项卡上定义变量。请参阅https://go.microsoft.com/fwlink/?linkid=865972 您的构建管道引用了一个名为“buildPlatform”的未定义变量。为此 YAML 文件创建或编辑构建管道,在“变量”选项卡上定义变量。请参阅https://go.microsoft.com/fwlink/?linkid=865972 您的构建管道引用了一个名为“cert.secureFilePath”的未定义变量。为此 YAML 文件创建或编辑构建管道,在“变量”选项卡上定义变量。请参阅https://go.microsoft.com/fwlink/?linkid=865972 您的构建管道引用“BuildConfiguration”变量,您已选择该变量可在排队时设置。为此 YAML 文件创建或编辑构建管道,在“变量”选项卡上定义变量,然后选择选项以使其在排队时可设置。请参阅https://go.microsoft.com/fwlink/?linkid=865971 变量:appxPackageDir: '$(build.artifactStagingDirectory)\AppxPackages\' 步骤: - 任务:NuGetToolInstaller@0 displayName: 'Use NuGet 4.4.1' 输入:版本规范:4.4.1
任务:NuGetCommand@2 displayName:'NuGet restore ***.sln' 输入:restoreSolution:'$(Parameters.solution)'
任务:DownloadSecureFile@1 displayName:'下载安全文件'输入:secureFile:'$(Parameters.secureFile)'
任务:VSBuild@1 displayName:'构建解决方案 Main/BoardPACWinApp.sln' 输入:解决方案:Main/BoardPACWinApp.sln vsVersion:16.0
msbuildArgs: '/p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="$(appxPackageDir)" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /p:AppxPackageSigningEnabled=true /p:PackageCertificateThumbprint="" /p:PackageCertificateKeyFile="$(cert.secureFilePath)"' 平台:x64 配置:'$(BuildConfiguration)' 清洁:true msbuildArchitecture:x64
任务:PublishBuildArtifacts@1 displayName:'发布工件:drop' 输入:PathtoPublish:'$(Build.ArtifactStagingDirectory)\AppxPackages' 启用:false
任务:AppCenterDistribute@0 displayName:'部署到 Visual Studio App Center' 输入:symbolIncludeParentDirectory:false 启用:false
对于此设置,我使用了带有测试证书 (BoardPACWinApp_TemporaryKey.pfx) 的 VS 2019 16.3 构建工具,没有密码。请注意,我已经在构建服务器(Windows Server 2019(OS Build 17763.437))上安装了 VS 2019,只是为了确保构建成功并且确实如此。但是当我在 DevOps 构建代理上尝试同样的事情时,它会抛出错误。
MSBuild 参数:
[命令]"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\amd64\msbuild.exe" "C:\agent_work\4\s\Main\BoardPACWinApp.sln" / nologo /nr:false /dl:CentralLogger,"C:\agent_work_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.146.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId= 1f510b32-fa94-449c-ba47-94b46a5869d0|SolutionDir=C:\agent_work\4\s\Main"*ForwardingLogger,"C:\agent_work_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.146.0\ps_modules\MSBuildHelpers\ Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:AppxBundlePlatforms="x64" /p:AppxPackageDir="C:\agent_work\4\a\AppxPackages\" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /p:AppxPackageSigningEnabled=true /p:PackageCertificateThumbprint="" /p:PackageCertificateKeyFile="C:\agent_work_temp\BoardPACWinApp_TemporaryKey.pfx" /p:platform="x64" /p:configuration="release" /p:VisualStudioVersion="16.0" / p:_MSDeployUserAgent="TFS_22ec7900-72ed-4ebd-b5a6-d4ba51a210dd_build_16_0"
错误:
[错误]C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Microsoft.AppXPackage.Targets(1300,5):错误 MSB3816:加载程序集“C :\Windows\ServiceProfiles\NetworkService.nuget\packages\runtime.win7.system.private.uri\4.3.0\runtimes\aot\lib\netcore50\System.Private.Uri.dll”失败。System.IO.FileNotFoundException:无法加载文件或程序集“System.Private.CoreLib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。该系统找不到指定的文件。
[错误]C:\Windows\ServiceProfiles\NetworkService.nuget\packages\runtime.win7.system.private.uri\4.3.0\runtimes\aot\lib\netcore50\System.Private.Uri.dll(0,0) : 错误 MSB3103:Resx 文件无效。字符串引用未设置为字符串的实例。参数名称:后缀
我的应用程序的 csproj:
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{F48A0CA8-2DA5-472A-B973-602F1645B32C}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>com.IronOne.BoardPACWinApp</RootNamespace>
<AssemblyName>BoardPACWinApp</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.10240.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>BoardPACWinApp_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>9B26FCF3AA71B71D3A1FE446F7002DB921BA5B68</PackageCertificateThumbprint>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
<AppxPackageDir>C:\temp\</AppxPackageDir>
<AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>
<AppxBundle>Always</AppxBundle>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<AppxSymbolPackageEnabled>True</AppxSymbolPackageEnabled>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppInstallerUpdateFrequency>0</AppInstallerUpdateFrequency>
<AppInstallerCheckForUpdateFrequency>OnApplicationRun</AppInstallerCheckForUpdateFrequency>
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
如果你想让我调整我的 CI 设置,请告诉我我会做并发布我遇到的错误。谢谢你。