UWP 应用程序的 VSTS 2017 CI 找不到文件(NuGet 包任务也出错)

VSTS 2017 CI for UWP Application Fails To Find Files (NuGet Package Task Error Too)

我确定这是用户错误,但许多 Microsoft 文档要么是为 VSTS 管理员编写的,要么老实说已经过时(因为步骤中甚至不匹配 VisualStudio Online 的 UI .) 我已尽我所能使它启动并正常工作。

错误:

******************************************************************************
Starting: NuGet Install for SNR3
******************************************************************************
==============================================================================
Task         : NuGet Restore
Description  : Restores NuGet packages in preparation for a Visual Studio Build step.
Version      : 1.0.0
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613747)
==============================================================================
C:\Windows\system32\chcp.com 65001
Active code page: 65001
Error: Not found files: d:\a\s\SNR3.sln
Packages failed to restore

错误 v2:

******************************************************************************
Starting: NuGet Install for SNR3
******************************************************************************
==============================================================================
Task         : NuGet Installer
Description  : Installs or restores missing NuGet packages
Version      : 0.2.31
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613747)
==============================================================================
C:\Windows\system32\chcp.com 65001
Active code page: 65001
Error: Not found files: d:\a\s\SNR3.sln
Packages failed to install

完整日志:

 Hosted Agent successfully assigned.
 Configuring connection settings for Hosted Agent
 Starting Hosted Agent
 Initializing connection to Hosted Agent
 ##[section]Starting: Build
 Current agent version: '2.116.1'
 ##[debug]Cleaning agent temp folder: d:\a\_temp
 ##[debug]SET TMP=d:\a\_temp
 ##[debug]SET TEMP=d:\a\_temp
 ##[section]Starting: Initialize Job
 ##[debug]Primary repository: Contracts. repository type: TfsVersionControl
 Prepare build directory.
 ##[debug]Creating build directory: 'd:\a'
 ##[debug]Delete existing artifacts directory: 'd:\a\a'
 ##[debug]Creating artifacts directory: 'd:\a\a'
 ##[debug]Delete existing test results directory: 'd:\a\TestResults'
 ##[debug]Creating test results directory: 'd:\a\TestResults'
 ##[debug]Creating binaries directory: 'd:\a\b'
 ##[debug]Creating source directory: 'd:\a\s'
 Set build variables.
 Download all required tasks.
 Downloading task: NuGetInstaller
 ##[debug]Task 'NuGetInstaller' has been downloaded into 'd:\a\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b[=13=].2.31'.
 Downloading task: VSBuild
 ##[debug]Task 'VSBuild' has been downloaded into 'd:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda.113.0'.
 Downloading task: PublishBuildArtifacts
 ##[debug]Task 'PublishBuildArtifacts' has been downloaded into 'd:\a\_tasks\PublishBuildArtifacts_2ff763a7-ce83-4e1f-bc89-0ae63477cebe.0.41'.
 ##[section]Finishing: Initialize Job
 ##[debug]Evaluating condition for step: 'Get Sources'
 ##[debug]Evaluating: succeeded()
 ##[debug]Evaluating succeeded:
 ##[debug]=> (Boolean) True
 ##[debug]Expanded: True
 ##[debug]Result: True
 ##[section]Starting: Get Sources
 ##[debug]Sync source for endpoint: Contracts
 Prepending Path environment variable with directory containing 'tf.exe'.
 ##[debug]Path: 'C:\LR\mms\Services\Mms\Provisioner\TaskAgent\agents.116.1\externals\vstsom;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server0\Tools\Binn\;C:\Program Files\Microsoft SQL Server0\Tools\Binn\;C:\Program Files\Microsoft SQL Server0\DTS\Binn\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server0\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript.4\;C:\Users\VssAdministrator\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server0\Tools\Binn\;C:\Program Files\Microsoft SQL Server0\Tools\Binn\;C:\Program Files (x86)\Microsoft Emulator Manager.0\;C:\Program Files (x86)\Windows Kits\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI\wbin;C:\Program Files (x86)\Microsoft SQL Server0\Tools\Binn\;C:\Program Files\Microsoft\Web Platform ...
 Querying workspace information.
 ##[debug]tf vc workspaces /format:xml /collection:https://houseofcat.visualstudio.com/ /loginType:OAuth /login:.,******** /noprompt
 ##[debug]<Workspaces />
 ##[debug]Sources directory does not exist or is empty.
 ##[debug]tf vc workspaces ws_1_1 /computer:* /format:xml /collection:https://houseofcat.visualstudio.com/ /loginType:OAuth /login:.,******** /noprompt
 ##[debug]<Workspaces>
 ##[debug] <Workspace computer="FACTORYVM-38" islocal="true" name="ws_1_1" ownerdisp="Project Collection Build Service (bytemedev)" ownerid="b58bda4f-3d2b-42b9-92af-0459c5f935e1:Build:6efb2b2a-0a99-489e-826b-892f9a3ad494" ownertype="Microsoft.TeamFoundation.ServiceIdentity" owner="c1289161-e96b-4d2f-8b38-2d28cb3f20de" owneruniq="c1289161-e96b-4d2f-8b38-2d28cb3f20de">
 ##[debug] <Comment />
 ##[debug] <Folders>
 ##[debug] <WorkingFolder local="d:\a\s\Contracts" item="$/Contracts" />
 ##[debug] <WorkingFolder item="$/Contracts/Drops" type="Cloak" />
 ##[debug] </Folders>
 ##[debug] <LastAccessDate>2017-05-14T20:57:33.677+00:00</LastAccessDate>
 ##[debug] <OwnerAliases>
 ##[debug] <string>Buildefb2b2a-0a99-489e-826b-892f9a3ad494</string>
 ##[debug] <string>6efb2b2a-0a99-489e-826b-892f9a3ad494</string>
 ##[debug] <string>Project Collection Build Service (bytemedev)</string>
 ##[debug] </OwnerAliases>
 ##[debug] </Workspace>
 ##[debug]</Workspaces>
 ##[command]tf vc workspace /delete ws_1_1;c1289161-e96b-4d2f-8b38-2d28cb3f20de /collection:https://houseofcat.visualstudio.com/ /loginType:OAuth /login:.,******** /noprompt
 ##[debug]Deleting: 'd:\a\s'.
 ##[command]tf vc workspace /new /location:local /permission:Public ws_1_1 /collection:https://houseofcat.visualstudio.com/ /loginType:OAuth /login:.,******** /noprompt
 ##[command]tf vc workfold /unmap /workspace:ws_1_1 $/ /collection:https://houseofcat.visualstudio.com/ /loginType:OAuth /login:.,******** /noprompt
 ##[command]tf vc workfold /map /workspace:ws_1_1 $/Contracts d:\a\s\Contracts /collection:https://houseofcat.visualstudio.com/ /loginType:OAuth /login:.,******** /noprompt
 ##[command]tf vc workfold /cloak /workspace:ws_1_1 $/Contracts/Drops /collection:https://houseofcat.visualstudio.com/ /loginType:OAuth /login:.,******** /noprompt
 ##[command]tf vc get /version:497 /recursive /overwrite d:\a\s /loginType:OAuth /login:.,******** /noprompt
 All files are up to date.
 ##[section]Finishing: Get Sources
 ##[debug]Evaluating condition for step: 'NuGet install $/Contracts/SNR3/SNR3.sln'
 ##[debug]Evaluating: succeeded()
 ##[debug]Evaluating succeeded:
 ##[debug]=> (Boolean) True
 ##[debug]Expanded: True
 ##[debug]Result: True
 ##[section]Starting: NuGet install $/Contracts/SNR3/SNR3.sln
 ==============================================================================
 Task : NuGet Installer
 Description : Installs or restores missing NuGet packages
 Version : 0.2.31
 Author : Microsoft Corporation
 Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613747)
 ==============================================================================
 ##[debug]tf vc resolvePath $\Contracts\SNR3\SNR3.sln /loginType:OAuth /login:.,******** /noprompt
 ##[debug]d:\a\s\Contracts\SNR3\SNR3.sln
 ##[debug]tf vc resolvePath $\Contracts\SNR3\SNR3\nuget.config /loginType:OAuth /login:.,******** /noprompt
 ##[debug]d:\a\s\Contracts\SNR3\SNR3\nuget.config
 ##[debug]agent.workFolder=d:\a
 ##[debug]loading inputs and endpoints
 ##[debug]loading ENDPOINT_AUTH_$/
 ##[debug]loading ENDPOINT_AUTH_PARAMETER_$/_ACCESSTOKEN
 ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
 ##[debug]loading ENDPOINT_AUTH_SCHEME_$/
 ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
 ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
 ##[debug]loading INPUT_NOCACHE
 ##[debug]loading INPUT_NUGETCONFIGPATH
 ##[debug]loading INPUT_NUGETVERSION
 ##[debug]loading INPUT_RESTOREMODE
 ##[debug]loading INPUT_SOLUTION
 ##[debug]loading INPUT_VERBOSITY
 ##[debug]loaded 12
 ##[debug]check path : d:\a\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b[=13=].2.31\task.json
 ##[debug]set resource file to: d:\a\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b[=13=].2.31\task.json
 ##[debug]system.culture=en-US
 ##[debug]Absolute path for pathSegments: C:\Windows\system32\chcp.com = C:\Windows\system32\chcp.com
 ##[debug]check path : C:\Windows\system32\chcp.com
 ##[debug]C:\Windows\system32\chcp.com=C:\Windows\system32\chcp.com
 ##[debug]C:\Windows\system32\chcp.com arg: ["65001"]
 ##[debug]C:\Windows\system32\chcp.com arg: ["65001"]
 ##[debug]exec tool: C:\Windows\system32\chcp.com
 ##[debug]exec tool: C:\Windows\system32\chcp.com
 ##[debug]Arguments:
 ##[debug]Arguments:
 ##[debug] 65001
 ##[debug] 65001
 [command]C:\Windows\system32\chcp.com 65001
 Active code page: 65001
 ##[debug]solution=d:\a\s\Contracts\SNR3\SNR3.sln
 ##[debug]System.DefaultWorkingDirectory=d:\a\s
 ##[debug]pattern: d:\a\s\Contracts\SNR3\SNR3.sln, isNegative: false
 ##[debug]check path : d:\a\s\Contracts\SNR3\SNR3.sln
 ##[error]Error: Not found files: d:\a\s\Contracts\SNR3\SNR3.sln
 ##[debug]Processed: ##vso[task.issue type=error;]Error: Not found files: d:\a\s\Contracts\SNR3\SNR3.sln
 ##[debug]task result: Failed
 ##[error]Packages failed to install
 ##[debug]Processed: ##vso[task.issue type=error;]Packages failed to install
 ##[debug]Processed: ##vso[task.complete result=Failed;]Packages failed to install
 ##[section]Finishing: NuGet install $/Contracts/SNR3/SNR3.sln
 ##[debug]Evaluating condition for step: 'Build solution $/Contracts/SNR3/SNR3.sln'
 ##[debug]Evaluating: succeeded()
 ##[debug]Evaluating succeeded:
 ##[debug]=> (Boolean) False
 ##[debug]Expanded: False
 ##[debug]Result: False
 ##[debug]Evaluating condition for step: 'Publish Artifact: drop'
 ##[debug]Evaluating: succeededOrFailed()
 ##[debug]Evaluating succeededOrFailed:
 ##[debug]=> (Boolean) True
 ##[debug]Expanded: True
 ##[debug]Result: True
 ##[section]Starting: Publish Artifact: drop
 ==============================================================================
 Task : Publish Build Artifacts
 Description : Publish Build artifacts to the server or a file share
 Version : 1.0.41
 Author : Microsoft Corporation
 Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=708390)
 ==============================================================================
 ##[debug]agent.workFolder=d:\a
 ##[debug]loading inputs and endpoints
 ##[debug]loading ENDPOINT_AUTH_$/
 ##[debug]loading ENDPOINT_AUTH_PARAMETER_$/_ACCESSTOKEN
 ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
 ##[debug]loading ENDPOINT_AUTH_SCHEME_$/
 ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
 ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
 ##[debug]loading INPUT_ARTIFACTNAME
 ##[debug]loading INPUT_ARTIFACTTYPE
 ##[debug]loading INPUT_PATHTOPUBLISH
 ##[debug]loading INPUT_TARGETPATH
 ##[debug]loaded 10
 ##[debug]check path : d:\a\_tasks\PublishBuildArtifacts_2ff763a7-ce83-4e1f-bc89-0ae63477cebe.0.41\task.json
 ##[debug]set resource file to: d:\a\_tasks\PublishBuildArtifacts_2ff763a7-ce83-4e1f-bc89-0ae63477cebe.0.41\task.json
 ##[debug]system.culture=en-US
 ##[debug]system.hostType=build
 ##[debug]PathtoPublish=d:\a\a\AppxPackages
 ##[debug]check path : d:\a\a\AppxPackages
 ##[debug]task result: Failed
 ##[error]Publish build artifacts failed with error: Not found PathtoPublish: d:\a\a\AppxPackages
 ##[debug]Processed: ##vso[task.issue type=error;]Publish build artifacts failed with error: Not found PathtoPublish: d:\a\a\AppxPackages
 ##[debug]Processed: ##vso[task.complete result=Failed;]Publish build artifacts failed with error: Not found PathtoPublish: d:\a\a\AppxPackages
 ##[section]Finishing: Publish Artifact: drop
 ##[debug]Evaluating condition for step: 'Post Job Cleanup'
 ##[debug]Always run post-job step: 'Post Job Cleanup'
 ##[section]Starting: Post Job Cleanup
 ##[section]Finishing: Post Job Cleanup
 ##[debug]Cleaning agent temp folder: d:\a\_temp
 ##[section]Finishing: Build

供稿URL: http://nuget.syncfusion.com/nuget_universalwindows/nuget/getsyncfusionpackages/universalwindows

让我的情况有点独特的事情是,我正在为 Syncfusion 控件使用自定义 NuGet 提要。我确实读到绝对有必要使用自定义提要 NuGet.config(其中一个不是在 VS2017 和 UWP Creator's Update 构建中生成的),所以我这样做了,将它添加到我的源代码管理中,并签入了它。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="Syncfusion UWP" value="http://nuget.syncfusion.com/nuget_universalwindows/nuget/getsyncfusionpackages/universalwindows" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
</configuration>

我尝试过的事情:

以下是最新的 UI / 配置选项的屏幕截图。也许有人能看出我的错误?

根据日志,您正在使用 Hosted Build Agent,这意味着源代码之前不应存在于构建代理中。但是构建日志表明自 "All files are up to date".

以来的第一个 "Get Sources" 步骤中没有下载文件
 ##[command]tf vc workspace /new /location:local /permission:Public ws_1_1 /collection:https://houseofcat.visualstudio.com/ /loginType:OAuth /login:.,******** /noprompt
 ##[command]tf vc workfold /unmap /workspace:ws_1_1 $/ /collection:https://houseofcat.visualstudio.com/ /loginType:OAuth /login:.,******** /noprompt
 ##[command]tf vc workfold /map /workspace:ws_1_1 $/Contracts d:\a\s\Contracts /collection:https://houseofcat.visualstudio.com/ /loginType:OAuth /login:.,******** /noprompt
 ##[command]tf vc workfold /cloak /workspace:ws_1_1 $/Contracts/Drops /collection:https://houseofcat.visualstudio.com/ /loginType:OAuth /login:.,******** /noprompt
 ##[command]tf vc get /version:494 /recursive /overwrite d:\a\s /loginType:OAuth /login:.,******** /noprompt
 All files are up to date.

这可能是由于:

  1. 您的源代码未成功签入 VSTS。打开 VSTS Web 门户,然后转到 "Code" 中心检查您是否可以看到您的源代码。

  2. "Get Sources" 步骤中的 "Workspace mappings" 不正确。单击“...”按钮 select 您要映射的正确文件夹,然后再次尝试构建。

我已通过删除整个 Visual Studio Team Services (VSTS Online) 帐户纠正了我的问题。

  • 创建了一个新的 VSTS 在线帐户。
  • 创建了一个新项目。
  • 创建本地映射(我的开发箱)。
  • 打开我的解决方案,添加到源代码管理,并签入更改。

希望这对遇到此问题的其他人有所帮助。

我成功使用 VSTS CI 使用这些设置构建 UWP(Creator's Update 2017)应用程序: