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

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

问题描述

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

首先将项目检出,然后nuget还原必要的程序包,然后构建.NET.我使用Windows 2019作为Azure管道代理来使构建成功.但是,在ubuntu代理上运行任务(.NET除外)大约需要7分钟才能完成!大约需要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 文件中删除以下几行:

 <导入项目=".. \ packages \ Microsoft.Net.Compilers.2.4.0 \ build \ Microsoft.Net.Compilers.props"条件=存在('.. \ packages \ Microsoft.Net.Compilers.2.4.0 \ build \ Microsoft.Net.Compilers.props')"/><错误条件=!Exists('.. \ packages \ Microsoft.Net.Compilers.2.4.0 \ build \ Microsoft.Net.Compilers.props')"文字="$([System.String] :: Format('$(ErrorText)','.. \ packages \ Microsoft.Net.Compilers.2.4.0 \ build \ Microsoft.Net.Compilers.props')))"/><错误条件=!Exists('.. \ packages \ Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8 \ build \ net45 \ Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')"文本="$([System.String] :: Format('$(ErrorText)','.. \ packages \ Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8 \ build \ net45 \ Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))"/> 

要给答案一些背景信息,该帖子此处表示从MSBuild集成程序包还原为自动程序包还原(裸还原任务)暗含 Microsoft.Net.Compilers < Import> &Error; Error Condition> 片段/需要 .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="..\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'))" />

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天全站免登陆