.net - MSBuild 尝试将 .NET 核心目标用于 .NET Framework 项目
问题描述
我有 .NET 4.6 Web 应用程序,它在我的机器上构建良好 - 来自 Visual Studio 和 MSBuild 命令行。在不同的机器上(构建代理,安装了 Visual Studio),我得到如下构建错误:
[restore] C:\blabla\myapp.csproj(430,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.100\Microsoft\VisualStudio\v15.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.
在 csproj 文件中,导入看起来像这样
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
所以似乎出于某种原因VSToolsPath
设置为。C:\Program Files\dotnet\sdk\2.1.100\Microsoft\VisualStudio\v15.0
在我看来,就像 MSBuild 正在尝试使用 .NET Core “工具”。这可能是什么原因以及如何解决?
编辑:添加构建命令(bat 文件):
set PATH="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin";%PATH%
msbuild "mysolution.sln" /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" /p:TargetProfile="ProdCloud"
解决方案
推荐阅读
- python - 使用嵌套键值的总和对嵌套字典进行排序
- python - Python - 主成分分析错误
- python - 3D CNN 在图像序列上的输入形状应该是什么?
- mongodb - MongoDB Realm SwiftUI 继续会话/自动登录
- python - Sympy 表达式生成函数将所有时间都花在 __mul__ 中;如何加快速度?
- python - 用于 Mac 和 Windows 的 python 3 中的定时输入
- vb.net - VB.net,无法访问已添加到项目的 OpenFileDialog
- elixir - 如何漂亮打印 Elixir 错误
- c - 使用 putw() 时在文件中获取乱码
- flutter - 颤振克隆地图更新两个值