如何杀死 Ubuntu 代理上的 VBCSCompiler.exe? [英] How to kill VBCSCompiler.exe on Ubuntu agent?

查看:24
本文介绍了如何杀死 Ubuntu 代理上的 VBCSCompiler.exe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 Azure Devops 构建管道,并尝试在 bitbucket (git) 上构建我的 ASP.NET MVC 和 Angular 混合站点项目.

首先签出项目,然后 nuget 恢复必要的包,然后构建 .NET.我使用 Windows 2019 作为 azure 管道代理以使构建成功.但是,它需要大约 7 分钟才能完成,而在 ubuntu 代理上运行任务(除了 .Net)要快得多!大约需要 2 分钟!

因此,我想使用 ubuntu,但我遇到了 MSBuild 任务的问题...

/home/vsts/work/1/s/Bobby.ProjectA/Bobby.ProjectA.csproj"(默认目标)(1)->(KillVBCSCompilerAndRetryCopy 目标) ->/home/vsts/work/1/s/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8/build/net45/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props(23,5):错误 MSB4044:KillProcess";任务没有被赋予所需参数ImagePath"的值.[/home/vsts/work/1/s/Bobby.ProjectA/Bobby.ProjectA.csproj]

根据

使用这种方法,我是否面临一条死胡同?该构建在 Windows 2019 上运行良好,但需要的时间太长,所以如果我可以让它在 ubuntu 上成功运行,那就太好了!

解决方案

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

.csproj 文件中删除以下行:

<导入项目=..packagesMicrosoft.Net.Compilers.2.4.0uildMicrosoft.Net.Compilers.props"条件=存在('..packagesMicrosoft.Net.Compilers.2.4.0uildMicrosoft.Net.Compilers.props')"/><错误条件="!Exists('..packagesMicrosoft.Net.Compilers.2.4.0uildMicrosoft.Net.Compilers.props')"Text="$([System.String]::Format('$(ErrorText)', '..packagesMicrosoft.Net.Compilers.2.4.0uildMicrosoft.Net.Compilers.props'))"/><错误条件="!Exists('..packagesMicrosoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8uild
et45Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')"Text="$([System.String]::Format('$(ErrorText)', '..packagesMicrosoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8uild
et45Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))"/>

为了给答案提供一些背景信息,这篇文章这里表明从 MSBuild-Integrated Package Restore 转换为 Automatic Package还原(nuget 还原任务)暗示 Microsoft.Net.Compilers 片段不再相关/需要在 .csproj 文件中.

I created an Azure Devops Build pipeline and i am trying to build my ASP.NET MVC and Angular hybrid site project on bitbucket (git).

The project first gets checked out, and nuget restores the necessary packages, and then the .NET builds. I used windows 2019 as azure pipeline agent for the build to succeed. however, Its taking about 7 minutes to complete, whilst running the tasks (besides .Net) on a ubuntu agent is much faster! takes around 2 mins instead!

Therefore, I'd like to use ubuntu, but im running into an issue with the MSBuild task...

"/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]

According to this post, VBCSCompiler.exe continues running from the Compiler Nuget package (nuget restore task?) so it locks the src folders and prevented future builds from running, e.g. causing error like this:

/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]

So the solution would be to kill the VBCSCompiler.exe but since i cant actually access the hosted machine during the build, im not sure how to do that.

screenshot of my pipeline so far:

Am i facing a dead-end path here with this approach? The build runs fine on windows 2019 but it just takes too long, so thats why if i can make it run on ubuntu successfully that would be great!

解决方案

The build on Ubuntu 20 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!!

Remove the following lines from the .csproj file:

<Import Project="..packagesMicrosoft.Net.Compilers.2.4.0uildMicrosoft.Net.Compilers.props" Condition="Exists('..packagesMicrosoft.Net.Compilers.2.4.0uildMicrosoft.Net.Compilers.props')" />

<Error Condition="!Exists('..packagesMicrosoft.Net.Compilers.2.4.0uildMicrosoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..packagesMicrosoft.Net.Compilers.2.4.0uildMicrosoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..packagesMicrosoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8uild
et45Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..packagesMicrosoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8uild
et45Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />

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.

这篇关于如何杀死 Ubuntu 代理上的 VBCSCompiler.exe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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