程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了为什么 MSBuild 会查看不正确的路径?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决为什么 MSBuild 会查看不正确的路径??

开发过程中遇到为什么 MSBuild 会查看不正确的路径?的问题如何解决?下面主要结合日常开发的经验,给出你关于为什么 MSBuild 会查看不正确的路径?的解决方法建议,希望对你解决为什么 MSBuild 会查看不正确的路径?有所启发或帮助;

我一直在尝试在本地使用 Visual studio 2017 社区构建 .NET 项目。@H_675_3@

使用 Publish 选项完成后构建工作正常,但在尝试使用 @H_805_5@msbuild 时抛出以下错误@H_675_3@

C:\Users\ajay3\source\repos\Triyo.API\TriyoCore.API>msbuild
Microsoft (R) Build ENGIne version 4.8.4084.0
[Microsoft .NET Framework,version 4.0.30319.42000]
copyright (C) Microsoft Corporation. All rights reserved.
Build started 2021-06-28 3:55:47 Pm.
Project "C:\Users\ajay3\source\repos\Triyo.API\TriyoCore.API\TriyoCore.API.csproj" on node 1 (default targets).
C:\Users\ajay3\source\repos\Triyo.API\TriyoCore.API\TriyoCore.API.csproj(281,3): error MSB4019: The imported project "C:\Program files (x86)\MSBuild\Microsoft\VisualSt
udio\**v11.0**\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <import> declaration is correct,and that the file exists on disk.
Done Building Project "C:\Users\ajay3\source\repos\Triyo.API\TriyoCore.API\TriyoCore.API.csproj" (default targets) -- Failed.
Build Failed.
"C:\Users\ajay3\source\repos\Triyo.API\TriyoCore.API\TriyoCore.API.csproj" (default target) (1) ->
  C:\Users\ajay3\source\repos\Triyo.API\TriyoCore.API\TriyoCore.API.csproj(281,3): error MSB4019: The imported project "C:\Program files (x86)\MSBuild\Microsoft\Visual
studio\**v11.0**\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <import> declaration is correct,and that the file exists on
 disk.
    0 Warning(s)
    1 Error(s)
Time Elapsed 00:00:00.08

我在 Stackoverflow 和其他各种网站上浏览了各种类似的文章,但没有任何帮助。@H_675_3@

v11.0 从哪里拉?我的 csproj 文件中没有该值。@H_675_3@

解决方法

您使用的是正确版本的 @H_805_5@mSBuild 吗?@H_675_3@

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
C:\Windows\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\MSBuild.exe

@H_805_5@mSBuild 的路径可能因您的电脑而异@H_675_3@

如果 Yes 检查以下示例@H_675_3@

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe C:\Users\ajay3\source\repos\Triyo.API\TriyoCore.API\TriyoCore.API.csproj /t:Clean

有关更多信息,请运行以下命令:@H_675_3@

 C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /?

您也可以使用 this link@H_675_3@ ,

我清理了我的系统并重新安装了 msbuild,现在它可以正常工作了。@H_675_3@

大佬总结

以上是大佬教程为你收集整理的为什么 MSBuild 会查看不正确的路径?全部内容,希望文章能够帮你解决为什么 MSBuild 会查看不正确的路径?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。