首页 > 解决方案 > 旧项目中的 VS 2013 到 2019 (MSBuild) 升级

问题描述

我有大型(超过 200 个项目)解决方案并试图调查是否可以将 Visual Studio 从当前的 2013 升级到 2019。由于它的大小,解决方案有一堆 .bat 文件来完成编译(通过 ms构建)和本地 IIS 部署过程(测试类型和 SSDT 按需处理)。首先,我在当前版本的 VS 旁边安装了 2019。从 .bat 文件编译进展顺利,并且在部署期间仅在脚本中的某些路径上搞砸了。那时 msbuild 是从 VS 2019 命令提示符触发的,因为执行 .bat 文件导致使用 VS 2013 中的 ms build 12。默认情况下,我无法让系统读取 ms build 16.10.2 路径。

从我的 PC 中删除 VS 2013 并执行 .bat 以完全重新编译和部署 - ms build 16.10.2 正在正确使用,但它返回 3670~ 错误:错误 CS0246:类型或命名空间名称 - 3350 出现错误 CS0234:类型或命名空间名称 - 250 次出现

我有点困惑,因为没有此类错误的迹象,而 .cs 文件在 VS 2019 中打开。例如错误 CS0246 指向以下文件中的第 17 行和第 20 行:

在此处输入图像描述

VS 2019 中的编译会出现一些错误,例如

CA1506  'ServiceName.MethodName' is coupled with 31 different types from 13 different namespaces. Rewrite or refactor the method to decrease its class coupling, or consider moving the method to one of the other types it is tightly coupled with. A class coupling above 40 indicates poor maintainability, a class coupling between 40 and 30 indicates moderate maintainability, and a class coupling below 30 indicates good maintainability
CA1305  Because the behavior of 'int.ToString()' could vary based on the current user's locale settings, replace this call in 'ServiceName.MethodName(int, int)' with a call to 'int.ToString(IFormatProvider)'. If the result of 'int.ToString(IFormatProvider)' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'.

但它们不会出现在 .bat 重新编译的错误日志文件中。您有什么建议,什么可能导致当前状态?问候

标签: .netmsbuildupgrade

解决方案


推荐阅读