使用Team Foundation Build构建项目时出现错误MSB4184 Microsoft.LightSwitch.Publish.targets

时间:2016-08-08 19:20:00

标签: tfs msbuild msbuild-task build-server lightswitch-2012

公司我需要实施持续集成。使用Lightswitch和visual studio 2012开发项目。我们使用Team Foundation Server来管理源版本。我创建了一个构建定义和代理池,尝试使用MsBuild任务以编程方式运行构建过程到TFS中。

一切正常,但Build Solution步骤会抛出错误。以下是跟踪:

2016-08-08T17:30:17.1606552Z Checking if artifacts directory exists: C:\TFSAgent\_work\1\a
2016-08-08T17:30:17.1606552Z Deleting artifacts directory.
2016-08-08T17:30:17.1606552Z Creating artifacts directory.
2016-08-08T17:30:17.1762560Z Checking if test results directory exists: C:\TFSAgent\_work\1\TestResults
2016-08-08T17:30:17.1762560Z Deleting test results directory.
2016-08-08T17:30:17.1762560Z Creating test results directory.
2016-08-08T17:30:17.2230568Z Starting: Get sources
2016-08-08T17:30:17.2386617Z Entering TfvcSourceProvider.PrepareRepositoryAsync
2016-08-08T17:30:17.2386617Z localPath=C:\TFSAgent\_work\1\s
2016-08-08T17:30:17.2386617Z clean=False
2016-08-08T17:30:17.2386617Z sourceVersion=199
2016-08-08T17:30:17.2386617Z mappingJson={"mappings":[{"serverPath":"$/OmniPay","mappingType":"map","localPath":"\\"},{"serverPath":"$/OmniPay/Drops","mappingType":"cloak","localPath":"\\"}]}
2016-08-08T17:30:17.2386617Z Syncing repository: OmniPay (TFVC)
2016-08-08T17:30:17.2386617Z workspaceName=ws_1_3
2016-08-08T17:30:21.4039019Z Workspace Name: ws_1_3;45d6157a-c0a3-480c-9615-310b82a07e0e
2016-08-08T17:30:21.5130997Z tf get /version:199
2016-08-08T17:30:22.6987201Z Done syncing repository OmniPay to version 199 (workspace version C199)
2016-08-08T17:30:22.6987201Z Leaving TfvcSourceProvider.PrepareRepositoryAsync
2016-08-08T17:30:22.9015180Z Running tasks
2016-08-08T17:30:22.9327171Z Starting task: Build solution $/OmniPay/0-Development/OmniMerchant/OmniMerchant.sln
2016-08-08T17:30:22.9951206Z C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". ([scriptblock]::Create('if (!$PSHOME) { $null = Get-Item -LiteralPath ''variable:PSHOME'' } else { Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1'')) ; Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1'')) }')) 2>&1 | ForEach-Object { Write-Verbose $_.Exception.Message -Verbose } ; $env:TF_BUILD = 'True' ; Import-Module -Name 'C:\TFSAgent\tasks\VSBuild\1.0.37\ps_modules\VstsTaskSdk\VstsTaskSdk.psd1' -ArgumentList @{ NonInteractive = $true } -ErrorAction Stop ; $VerbosePreference = 'SilentlyContinue' ; $DebugPreference = 'SilentlyContinue' ; Invoke-VstsTaskScript -ScriptBlock ([scriptblock]::Create('. ''C:\TFSAgent\tasks\VSBuild\1.0.37\VSBuild.ps1'''))"
2016-08-08T17:30:24.8203363Z ##[warning]Visual Studio version '11.0' not found. Looking for the latest version.
2016-08-08T17:30:25.1947427Z ##[command]"C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" "C:\TFSAgent\_work\1\s\0-Development\OmniMerchant\OmniMerchant.sln" /nologo /nr:false /fl /flp:"logfile=C:\TFSAgent\_work\1\s\0-Development\OmniMerchant\OmniMerchant.sln.log" /dl:CentralLogger,"C:\TFSAgent\tasks\VSBuild\1.0.37\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"*ForwardingLogger,"C:\TFSAgent\tasks\VSBuild\1.0.37\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"  /p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="10.0"
2016-08-08T17:30:25.3195436Z Los proyectos de esta solución se van a compilar de uno en uno. Para habilitar la compilación en paralelo, agregue el modificador "/m".
2016-08-08T17:30:25.3351434Z Compilación iniciada a las 08/08/2016 12:30:25 p. m..
2016-08-08T17:30:25.5223466Z Proyecto "C:\TFSAgent\_work\1\s\0-Development\OmniMerchant\OmniMerchant.sln" en nodo 1 (destinos predeterminados).
2016-08-08T17:30:25.5223466Z ValidateSolutionConfiguration:
2016-08-08T17:30:25.5223466Z   Compilando la configuración de soluciones "release|any cpu".
2016-08-08T17:30:25.7719622Z ##[error]C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Publish\v1.8\Microsoft.LightSwitch.Publish.targets(31,9): Error MSB4184: La expresión "[System.IO.Path]::Combine(null, bin\x86)" no se puede evaluar. El valor no puede ser nulo. Nombre del parámetro: path1
2016-08-08T17:30:25.7719622Z El proyecto "C:\TFSAgent\_work\1\s\0-Development\OmniMerchant\OmniMerchant.sln" (1) está compilando "C:\TFSAgent\_work\1\s\0-Development\OmniMerchant\OmniMerchant.ls3proj" (2) en el nodo 1 (destinos predeterminados).
2016-08-08T17:30:25.7719622Z C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Publish\v1.8\Microsoft.LightSwitch.Publish.targets(31,9): error MSB4184: La expresión "[System.IO.Path]::Combine(null, bin\x86)" no se puede evaluar. El valor no puede ser nulo. Nombre del parámetro: path1 [C:\TFSAgent\_work\1\s\0-Development\OmniMerchant\OmniMerchant.ls3proj]
2016-08-08T17:30:25.8031476Z Compilación del proyecto terminada "C:\TFSAgent\_work\1\s\0-Development\OmniMerchant\OmniMerchant.ls3proj" (destinos predeterminados) -- ERROR.
2016-08-08T17:30:25.8499500Z Compilación del proyecto terminada "C:\TFSAgent\_work\1\s\0-Development\OmniMerchant\OmniMerchant.sln" (destinos predeterminados) -- ERROR.
2016-08-08T17:30:25.8499500Z ERROR al compilar.
2016-08-08T17:30:25.8499500Z "C:\TFSAgent\_work\1\s\0-Development\OmniMerchant\OmniMerchant.sln" (destino predeterminado) (1) ->
2016-08-08T17:30:25.8499500Z "C:\TFSAgent\_work\1\s\0-Development\OmniMerchant\OmniMerchant.ls3proj" (destino predeterminado) (2) ->
2016-08-08T17:30:25.8499500Z   C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Publish\v1.8\Microsoft.LightSwitch.Publish.targets(31,9): error MSB4184: La expresión "[System.IO.Path]::Combine(null, bin\x86)" no se puede evaluar. El valor no puede ser nulo. Nombre del parámetro: path1 [C:\TFSAgent\_work\1\s\0-Development\OmniMerchant\OmniMerchant.ls3proj]
2016-08-08T17:30:25.8499500Z     0 Advertencia(s)
2016-08-08T17:30:25.8499500Z     1 Errores
2016-08-08T17:30:25.8499500Z Tiempo transcurrido 00:00:00.29
2016-08-08T17:30:26.0371525Z ##[error]Process 'msbuild.exe' exited with code '1'.
2016-08-08T17:30:26.1307517Z Finishing task: VSBuild
2016-08-08T17:30:26.1307517Z Starting task: Copy Files to: $(build.artifactstagingdirectory)
2016-08-08T17:30:26.1463517Z Set workingFolder to default: C:\TFSAgent\tasks\CopyFiles\1.0.20
2016-08-08T17:30:26.4583580Z ##[debug]agent.workFolder=C:\TFSAgent\_work
2016-08-08T17:30:26.4583580Z ##[debug]loading inputs and endpoints
2016-08-08T17:30:26.4583580Z ##[debug]loading ENDPOINT_AUTH_$/
2016-08-08T17:30:26.4583580Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_$/_ACCESSTOKEN
2016-08-08T17:30:26.4583580Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2016-08-08T17:30:26.4583580Z ##[debug]loading ENDPOINT_AUTH_SCHEME_$/
2016-08-08T17:30:26.4583580Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2016-08-08T17:30:26.4583580Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2016-08-08T17:30:26.4583580Z ##[debug]loading INPUT_CLEANTARGETFOLDER
2016-08-08T17:30:26.4583580Z ##[debug]loading INPUT_CONTENTS
2016-08-08T17:30:26.4583580Z ##[debug]loading INPUT_OVERWRITE
2016-08-08T17:30:26.4583580Z ##[debug]loading INPUT_SOURCEFOLDER
2016-08-08T17:30:26.4583580Z ##[debug]loading INPUT_TARGETFOLDER
2016-08-08T17:30:26.4583580Z ##[debug]loaded 11
2016-08-08T17:30:26.4583580Z ##[debug]check path : C:\TFSAgent\tasks\CopyFiles\1.0.20\task.json
2016-08-08T17:30:26.4583580Z ##[debug]set resource file to: C:\TFSAgent\tasks\CopyFiles\1.0.20\task.json
2016-08-08T17:30:26.4739560Z ##[debug]system.culture=en-US
2016-08-08T17:30:26.4739560Z ##[debug]Contents=**\bin\release\**
2016-08-08T17:30:26.4739560Z ##[debug]SourceFolder=C:\TFSAgent\_work\1\s
2016-08-08T17:30:26.4739560Z ##[debug]check path : C:\TFSAgent\_work\1\s
2016-08-08T17:30:26.4739560Z ##[debug]TargetFolder=C:\TFSAgent\_work\1\a
2016-08-08T17:30:26.4739560Z ##[debug]CleanTargetFolder=false
2016-08-08T17:30:26.4739560Z ##[debug]OverWrite=false
2016-08-08T17:30:26.4739560Z ##[debug]include content pattern: **\bin\release\**
2016-08-08T17:30:26.7547577Z ##[debug]find C:\TFSAgent\_work\1\s
2016-08-08T17:30:26.7547577Z ##[debug]2219 matches.
2016-08-08T17:30:26.8795588Z ##[debug]allFiles contains 2012 files
2016-08-08T17:30:26.8795588Z ##[debug]Include matching C:\TFSAgent\_work\1\s\**\bin\release\**
2016-08-08T17:30:26.9107601Z ##[debug]Include matched 0 files
2016-08-08T17:30:26.9107601Z found 0 files
2016-08-08T17:30:26.9263593Z Finishing task: CopyFiles
2016-08-08T17:30:26.9419655Z Starting task: Publish Artifact: drop
2016-08-08T17:30:26.9419655Z Set workingFolder to default: C:\TFSAgent\tasks\PublishBuildArtifacts\1.0.34
2016-08-08T17:30:27.2383627Z ##[debug]agent.workFolder=C:\TFSAgent\_work
2016-08-08T17:30:27.2383627Z ##[debug]loading inputs and endpoints
2016-08-08T17:30:27.2383627Z ##[debug]loading ENDPOINT_AUTH_$/
2016-08-08T17:30:27.2383627Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_$/_ACCESSTOKEN
2016-08-08T17:30:27.2539635Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2016-08-08T17:30:27.2539635Z ##[debug]loading ENDPOINT_AUTH_SCHEME_$/
2016-08-08T17:30:27.2539635Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2016-08-08T17:30:27.2539635Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2016-08-08T17:30:27.2539635Z ##[debug]loading INPUT_ARTIFACTNAME
2016-08-08T17:30:27.2539635Z ##[debug]loading INPUT_ARTIFACTTYPE
2016-08-08T17:30:27.2539635Z ##[debug]loading INPUT_PATHTOPUBLISH
2016-08-08T17:30:27.2539635Z ##[debug]loading INPUT_TARGETPATH
2016-08-08T17:30:27.2539635Z ##[debug]loaded 10
2016-08-08T17:30:27.2539635Z ##[debug]check path : C:\TFSAgent\tasks\PublishBuildArtifacts\1.0.34\task.json
2016-08-08T17:30:27.2539635Z ##[debug]set resource file to: C:\TFSAgent\tasks\PublishBuildArtifacts\1.0.34\task.json
2016-08-08T17:30:27.2539635Z ##[debug]system.culture=en-US
2016-08-08T17:30:27.2539635Z ##[debug]PathtoPublish=C:\TFSAgent\_work\1\a
2016-08-08T17:30:27.2539635Z ##[debug]check path : C:\TFSAgent\_work\1\a
2016-08-08T17:30:27.2539635Z ##[debug]ArtifactName=drop
2016-08-08T17:30:27.2539635Z ##[debug]ArtifactType=Container
2016-08-08T17:30:27.2695627Z ##[debug]TargetPath=\\my\share\Merchant\20160808.4
2016-08-08T17:30:28.6267793Z Max Concurrent Uploads 2, Max Creators 1
2016-08-08T17:30:28.7048085Z Found 0 files to upload.
2016-08-08T17:30:28.7203860Z Created 0 files without uploading content. Total files processed 0
2016-08-08T17:30:28.7203860Z Uploaded artifact 'C:\TFSAgent\_work\1\a' to container folder 'drop' of build 24.
2016-08-08T17:30:29.6719971Z Associated artifact 12 with build 24
2016-08-08T17:30:29.6875965Z Finishing task: PublishBuildArtifacts
2016-08-08T17:30:29.7032002Z ##[error]System.Exception: Task VSBuild failed. This caused the job to fail. Look at the logs for the task for more details.
2016-08-08T17:30:29.7032002Z ##[error]   en Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.Run(IJobContext jobContext, IJobRequest job, IJobExtension jobExtension, CancellationTokenSource tokenSource)

第29行的错误如下:

2016-08-08T17:30:25.7719622Z ##[error]C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Publish\v1.8\Microsoft.LightSwitch.Publish.targets(31,9): Error MSB4184: La expresión "[System.IO.Path]::Combine(null, bin\x86)" no se puede evaluar. El valor no puede ser nulo. Nombre del parámetro: path1

英文表示:错误MSB4184:" [System.IO.Path] :: Combine(null,bin \ x86)"无法评估表达式。值不能为空。参数名称:path1

深入了解Microsoft.LightSwitch.Publish.Targets第39行:

<!--If the path to the sign tool is not set, try the Windows SDK path or the Framework SDK path -->
<_WindowsSDKSignToolPath  Condition="'$(SignToolPath)' == ''">$([System.IO.Path]::Combine('$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots', 'KitsRoot', null, RegistryView.Registry32, RegistryView.Default))', 'bin\x86'))</_WindowsSDKSignToolPath>

使用Visual Studio 2012编译项目非常完美,但是错误抛出TFS Build引用了OmniMerchant.ls3proj:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\LightSwitch\$(LightSwitchVersion)\Microsoft.LightSwitch.targets" />

我在服务器中创建了HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows Kits \ Installed Roots和KitsRoot键,我还根据开发者机器将所有文件夹和文件Microsoft \ VisualStudio \ LightSwitch复制到服务器中,但仍然显示错误。 请,需要帮助!感谢

1 个答案:

答案 0 :(得分:0)

我找到了答案,感谢Patrick-MSFT给了我很多帮助。

许多错误是由错过正确的框架版本以及缺少解决方案依赖性引起的。

TFS的构建代理根据在构建定义中配置的Visual Studio项目或最新版本搜索MSBuild。如果没有在构建服务器上安装正确的版本,MSBuild会搜索最新安装的版本,因此从Microsoft.LightSwitch.Publish.Targets执行以下行:

<_WindowsSDKSignToolPath  Condition="'$(SignToolPath)' == ''">$([System.IO.Path]::Combine('$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots', 'KitsRoot', null, RegistryView.Registry32, RegistryView.Default))', 'bin\x86'))</_WindowsSDKSignToolPath>

这引发了错误,正确的方法是克服这种错误:

根据Patrick-MSFT的说法,我已经安装了Visual Studio 2012 plus更新,以及所有必要的工具,就像我开发的PC到TFS Build服务器一样。

除此之外,还必须将未签入的所有项目依赖项程序集(DLL)都放入TFS。

现在我的版本是绿色!!