.net - 使用 MSBuild 构建混合 DotNet Core/.NET Framework

标签 .net msbuild .net-core visual-studio-2017

dotnet msbuild
从 sln 目录工作

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe

从解决方案目录作品

我不希望 VS 2017 必须安装在构建机器上,所以我安装了来自 https://www.visualstudio.com/downloads/ 的“Visual Studio 2017 构建工具” .
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe

对 sln 中的每个项目进行轰炸,并出现错误:

error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.



事实上 - 它不存在于磁盘上。它只存在于 VS 子文件夹中

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks

我已经手动尝试安装 .NET 4.6 SDK、.NET Core 1.0 SDK 和 .NET Core 1.0.1 SDK(x86 和 x64 版本)。

有什么方法可以使 MSBuild 正常运行,还是像其他很多东西一样无法修复?

最佳答案

我现在找到的唯一方法是创建一个编译配置,其中我针对所有 .NetCore 和 .net Standard 项目以及其他针对所有 .Net 项目(或仅使用发布配置)。

然后我使用 MsBuild 两次来构建。

MSBuild.exe MySolution.sln/p:Configuration=DotNetCore

MSBuild.exe MySolution.sln/p:Configuration=Release

它适用于 VS2017 解决方案。

关于.net - 使用 MSBuild 构建混合 DotNet Core/.NET Framework,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42930926/

相关文章:

c# - 关于 StringBuilder 的互操作问题

.net - 使用 ASP.Net <asp :SiteMapPath> control 垂直对齐面包屑

c# - 为什么使用ffmpeg实时创建视频文件时,ffmpeg.exe会占用1GB内存?

azure - 如何将额外文件添加到由 Visual Studio 中的 Azure 资源组项目调用的 msbuild 生成的包中

.NET Core 2 - 将文件夹复制到

C# 序列化不会向 xml 文件中的属性添加值

linux - 在 ASP .NET Core 2 和 Linux 上使用证书保护数据保护 key 文件

c# - 由于 commandTimeout 不够健壮,如何使用 Dapper 在 C# 中获得可靠的阻塞/缓慢数据库操作超时?

c# - Web API 与 SignalR

c# - Webdeploy权限问题