gpt4 book ai didi

c# - 较新版本的 MSBuild 能否编译较旧的 C# 解决方案?

转载 作者:行者123 更新时间:2023-12-05 05:18:39 25 4
gpt4 key购买 nike

我继承了一组构建脚本,这些脚本目前在 .sln 文件中查看,计算出它们是使用哪个版本的 Visual Studio 创建的,然后调用与该版本的 VS 关联的 MSBuild 版本。

有必要吗?还是最新版本的 MSBuild 会编译旧的解决方案/项目?

最佳答案

Can newer versions of MSBuild compile older C# solutions?

简单的回答是肯定的。

从 Visual Studio 构建项目时,Visual Studio 将调用 devenv.exe 来构建项目,然后 devenv 调用 msbuild 来执行构建。

根据官方文档Port, Migrate, and Upgrade Visual Studio Projects :

Each new version of Visual Studio generally supports most previous types of projects, files, and other assets. You can work with them as you always have, and provided that you don't depend on newer features, Visual Studio preserves backwards compatibility with previous versions like Visual Studio 2015, Visual Studio 2013, and Visual Studio 2012.

Support for some types change over time, however. A newer version of Visual Studio may no longer support certain types, or require that they be migrated and updated such that they're no longer backwards-compatible.

因此,最新版本的 MSBuild 支持大多数以前类型的旧解决方案/项目,但较新版本的 MSBuild 不再支持的解决方案/项目除外。

关于c# - 较新版本的 MSBuild 能否编译较旧的 C# 解决方案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47436572/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com