2016-08-08 107 views
0

公司我需要实施持续集成。通过在Visual Studio 2012中使用Lightswitch开发项目。我们使用Team Foundation Server来管理源版本。我创建了一个构建定义和代理池,以便使用MsBuild任务以编程方式运行构建过程到TFS中。错误MSB4184使用Team Foundation构建项目时的Microsoft.LightSwitch.Publish.targets构建

除了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] ::联合收割机(NULL,BIN \ x86)“不能评估表达式。值不能为空。参数名:路径1

走向深入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生成指OmniMerchant.ls3proj排队:

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

我创建HKEY_LOCAL_MACHINE \ SOFTWARE \微软\的Windows套件\安装根和服务器KitsRoot关键,也是我复制所有文件夹和文件Microsoft \ VisualStudio的\的LightSwitch到基于服务器的开发机器上,但错误ST生病正在显示。 请帮助!谢谢

+1

我注意到你的日志中没有找到'[警告] Visual Studio版本'11.0'的冲突。寻找最新的版本。 '你是否在你的构建定义中指出了正确的版本?这是否与您的本地构建环境在构建代理上工作,而不是通过TFS?并且还尝试将'release | any cpu'更改为'release | x86' –

+0

Patrick,您好,是否需要在构建服务器或某个sdk中安装Visual Studio 2012? –

+1

是的,您最好确保构建服务器(构建代理)的环境与本地环境相同。这将大大降低构建失败的风险。在构建代理上安装VS2012后再试一次。 –

回答

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中。

现在我的身材是绿色的!