c# - 找不到错误 MSB4226 MSBuild.Community.Tasks.Targets

标签 c# visual-studio msbuild visual-studio-2017

解决方案的新开发人员。我有源代码。当我尝试编译时出现以下错误。

之前,我在另一台计算机上解决了这个问题,方法是让项目的另一个开发人员压缩他的文件夹并将其发送给我。但我想了解如果我是这个项目的新手,我将如何解决这个问题。假设我不必依赖某人将压缩后的 .target 文件夹发送给我。

错误:

C:\Users\boyd\Source\Repos\insightstobehavior\Classroom_Package.proj(3,11):
 error MSB4226: The imported project "C:\Program Files (x86)\Microsoft Visual S
tudio\2017\Community\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targ
ets" was not found. Also, tried to find "MSBuildCommunityTasks\MSBuild.Communit
y.Tasks.Targets" in the fallback search path(s) for $(MSBuildExtensionsPath) -
"C:\Program Files (x86)\MSBuild" . These search paths are defined in "C:\Progra
m Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.e
xe.Config". Confirm that the path in the <Import> declaration is correct, and t
hat the file exists on disk in one of the search paths. 

来自.project-

 <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />

最佳答案

error MSB4226 MSBuild.Community.Tasks.Targets" was not found

要解决此问题,您应该安装 msbuildtasks msi 安装程序:

https://github.com/loresoft/msbuildtasks/releases/download/1.5.0.235/MSBuild.Community.Tasks.v1.5.0.235.msi

您可以查看 readme.md此 MSBuild 社区任务的一部分:

In order to use the tasks in this project, you need to import the MSBuild.Community.Tasks.Targets files.

If you installed the project with the msi installer, you can use the following.

<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>

安装该 msi 文件后,您将找到文件 MSBuild.Community.Tasks.Targets在路径 C:\Program Files (x86)\MSBuild\MSBuildCommunityTasks .

这将解决此问题。

希望这对您有所帮助。

关于c# - 找不到错误 MSB4226 MSBuild.Community.Tasks.Targets,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53107074/

相关文章:

c# - MSBuild 从输出中排除附属程序集

c# - 如何将图标添加到窗口窗体顶部栏(在最小化最大化按钮旁边)

visual-studio - 当目标在 VS 解决方案中失败时,如何使 msbuild 失败?

c++ - 如何修复错误 "Windows SDK version 8.1"未找到?

c++ - 什么是 DialogResult 函数 visual C++ 2010?

xml - 如何使用 MSBuild 创建 XML 文件?

c# - 文件夹未复制到输出目录

c# - Unity - 使用枚举属性来检测对象碰撞

c# - 即使使用有效的连接字符串也获取 "The requested URI does not represent any resource on the server"

c# - 特定 Controller 的操作列表