定位较旧的MSBuild版本 [英] Target older MSBuild version

查看:97
本文介绍了定位较旧的MSBuild版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近有一台全新的工作站,并在上面安装了VS2019。以前,我在VS2017上,我的团队的其余成员仍在2017年。在构建我们的SQL数据库单元测试项目时,我收到以下错误:


主要参考" ; Microsoft.Data.Tools.Schema.Sql.UnitTesting,Version = 16.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a,processorArchitecture = MSIL"无法解决,因为它对程序集具有间接依赖性
"Microsoft.Build,Version = 15.1.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a"它是针对".NETFramework,Version = v4.7.2"而构建的。框架。这是比当前目标框架".NETFramework,Version = v4.6.1"更高的版本。


所以我认为我需要降级MSBuild的版本我正在使用以便兼容?如果我去Visual Studio Installer,它说我已经安装了4.6.1和4.7.2框架。似乎没有选择选择我正在安装或使用的MSBuild


我不想强迫团队的其他成员升级到VS2019,也不必为此问题安装VS2017。


感谢社区提供的任何帮助!


解决方案


嗨Kharn,


欢迎来到MSDN论坛。


错误通常意味着构建环境的默认框架高于项目的目标框架。


请使用"-p:name = value"改变构建环境的框架。它设置了构建项目的临时目标框架。

 msbuild project.proj -p:TargetFrameworkVersion = V4.6.1 

希望它可以帮助你。


最好的问候,


Dylan



I recently got a brand new workstation and installed VS2019 on it. Previously, I was on VS2017 and the rest of my team is still on 2017. When building our SQL Database unit test project, I got the following error:

The primary reference "Microsoft.Data.Tools.Schema.Sql.UnitTesting, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the assembly "Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which was built against the ".NETFramework,Version=v4.7.2" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.6.1".

So I THINK I need to downgrade the version of MSBuild that I am using in order to be compatible?? If I go to the Visual Studio Installer, it says I have installed both 4.6.1 and 4.7.2 frameworks. There doesn't seem to be an option to choose which MSBuild I am currently installing or using.

I don't want to force the rest of my team to upgrade to VS2019, nor have to install VS2017 just for this issue.

Thanks for any help the community can provide!

解决方案

Hi Kharn,

Welcome to MSDN Forum.

The error often means the default framework of your build environment is higher than the target framework of your project.

Please use the "–p: name = value" to change the framework of build environment. It sets the temporary target framework to build your project.

msbuild project.proj -p:TargetFrameworkVersion=V4.6.1

Hope it can help you.

Best Regards,

Dylan


这篇关于定位较旧的MSBuild版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆