MSB4044:“KillProcess"任务没有为所需的参数“ImagePath"指定值. [英] MSB4044: The "KillProcess" task was not given a value for the required parameter "ImagePath"

查看:81
本文介绍了MSB4044:“KillProcess"任务没有为所需的参数“ImagePath"指定值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

长话短说,我能够在 windows 2019 azure 托管代理上成功构建一个 bitbucket .NET/MVC/Angular 项目,但我无法在 ubuntu 代理上成功构建它.我想在 ubuntu 上构建它的原因是因为我注意到构建时间比 windows 代理快得多,考虑到平台,这是有道理的.

Long story short, I was able to build a bitbucket .NET/MVC/Angular project successfully on windows 2019 azure hosted agent, but I am unable to make it build successfully on ubuntu agent. The reason I want to build it on ubuntu is because I noticed the build time is way faster than that of the windows agent, which makes sense considering the platforms.

我正面临这个错误:

Copying file from "/home/vsts/work/1/s/Bobby.ProjectA/obj/Debug/Bobby.ProjectA.pdb" to "/home/vsts/work/1/s/Bobby.ProjectA/bin/Bobby.ProjectA.pdb".
CopyRoslynCompilerFilesToOutputDirectory:
  Creating directory "/bin/roslyn".
  Creating directory "/bin/roslyn".
  Creating directory "/bin/roslyn".
  Creating directory "/bin/roslyn".

/home/vsts/work/1/s/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8/build/net45/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props(17,5): 
warning MSB3021: Unable to copy file "/home/vsts/work/1/s/packages/Microsoft.Net.Compilers.2.4.0/build/../tools/csc.exe" to "/bin/roslyn/csc.exe". Access to the path '/bin/roslyn' is denied. [/home/vsts/work/1/s/Bobby.ProjectA/Bobby.ProjectA.csproj]
"/home/vsts/work/1/s/Bobby.ProjectA/Bobby.ProjectA.csproj" (default target) (1) ->
(KillVBCSCompilerAndRetryCopy target) -> 
/home/vsts/work/1/s/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8/build/net45/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props(23,5): 
error MSB4044: The "KillProcess" task was not given a value for the required parameter "ImagePath". [/home/vsts/work/1/s/Bobby.ProjectA/Bobby.ProjectA.csproj]

根据 this 帖子,问题是因为 VBCSCompiler 正在锁定 src.

According to this post, the issue is because the VBCSCompiler is locking the src.

所以我已经用尽了所有这些解决方案这里来终止 VBCCompiler,但它们都不起作用.由于 CI 限制,我也无法在构建期间重新启动 ubuntu 代理,并且 killall VBCSCompiler msbuild 任务之前的 bash 脚本导致此错误:VBCSCompiler: no process found

So i have exhausted all of these solutions here to kill the VBCCompiler, but none of them worked. I also can't restart the ubuntu agent during a build due to CI limitation, and killall VBCSCompiler bash script before msbuild task resulted in this error: VBCSCompiler: no process found

所以现在我确定这与日志中的最后一条错误消息有关,即 error MSB4044: The KillProcess"任务没有为所需参数ImagePath"指定值.

So now i am sure that this has to do with the last error message on the log which is error MSB4044: The "KillProcess" task was not given a value for the required parameter "ImagePath".

根据这篇文章此处,我需要指定一个图像路径,但由于这是在构建代理上运行,我不能这样做,因为我不能像打开 Microsoft.codeDom.Providers.DotNetCompilerPlatform.props 文件那样简单地单击错误消息.

According to this post here, I would need to specify an image path but since this is running on a build agent, I can't do that since i can't simply click on the error message like the person did to open the Microsoft.codeDom.Providers.DotNetCompilerPlatform.props file.

我在项目中找不到这个文件,所以我认为它是在构建过程中创建的...

and i couldn't locate this file in the project, so i think it gets created during the build...

即使可以指定图像路径,路径是什么?/bin/roslyn?

and even if am able to specify an image path, what would be the path? /bin/roslyn?

推荐答案

终于成功了!我不知道为什么删除这些行可以解决 VBCSCompiler 问题,但是通过这样做,msbuild 在 Ubunutu 20 代理上成功完成!!

It finally worked! I don't know why removing these lines resolved the VBCSCompiler issue, but by doing so, the msbuild completed successfully on Ubunutu 20 agent!!

.csproj 文件中删除以下几行:

Remove the following lines from the .csproj file:

<Import Project="..\packages\Microsoft.Net.Compilers.2.4.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.2.4.0\build\Microsoft.Net.Compilers.props')" />

<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.2.4.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.2.4.0\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />

为了给出答案的一些上下文,这篇文章这里表明从 MSBuild-Integrated Package Restore 转换为 Automatic Package恢复(nuget 恢复任务)暗示 Microsoft.Net.Compilers 片段不再相关/needed 在 .csproj 文件中.

To give some context to the answer, this post here indicated that converting from MSBuild-Integrated Package Restore to Automatic Package Restore (nuget restore task) implied that the Microsoft.Net.Compilers <Import> and <Error Condition> snippets are no longer relevant/needed in the .csproj file.

更新:

在 Windows 代理上运行此程序时,您还需要从 删除以下行.csproj 文件

When running this on windows agent, you will also need to remove the following line as well from the .csproj file

<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />

在 Windows 代理上构建时解决这些警告:

to resolve these warnings when building on windows agent:

Warning MSB3030: Could not copy the file "\pagefile.sys" because it was not found.
Warning MSB4181: The "Copy" task returned false but did not log an error.

这篇关于MSB4044:“KillProcess"任务没有为所需的参数“ImagePath"指定值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆