更新后使用 Microsoft.Build 构建 VS 项目时出错

Getting an error building VS project using Microsoft.Build after update

我有一个 C# 项目,它使用 Microsoft.Build 库构建另一个项目。在我将 VS 升级到版本 16.11.5 之前,它工作得很好。现在,我在执行 project.Build():

时在下面的记录器文件中收到错误

ERROR C:\Program Files (x86)\Microsoft Visual Studio19\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4693,7): The "WroteAtLeastOneFile" parameter is not supported by the "Copy" task. Verify the parameter exists on the task, and it is a gettable public instance property.

我尝试从 VS 手动构建并且它有效但通过代码构建时无效。

打开 Microsoft.Common.CurrentVersion.targets 文件并删除以下元素并保存文件:

<Output TaskParameter =” WroteAtLeastOneFile “PropertyName =” WroteAtLeastOneFile “/>