在同一项目中目标为V4.7.2和netcoreapp3.1.值未超出预期范围 [英] Target V4.7.2 and netcoreapp3.1 in same project. Value does not fall witnin the expected range

查看:443
本文介绍了在同一项目中目标为V4.7.2和netcoreapp3.1.值未超出预期范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的Framework 4.7.2代码使用针对netcoreapp3.1的库 Nuget指示已引用该库,但在引用列表中看不到它.

I want my Framework 4.7.2 code to use a library that targets netcoreapp3.1 Nuget indicates that the library is referenced, yet I do not see it in the list of references.

我尝试编辑项目以从

<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>

<TargetFrameworkVersion>v4.7.2;netcoreapp3.1</TargetFrameworkVersion>

但是保存此更改会导致出现消息

But saving this change causes a message

我无法重新加载项目

我尝试链接到

<TargetFrameworkVersion>netcoreapp3.1;net472</TargetFrameworkVersion>

构建错误变为

Error       The expression "[Microsoft.Build.Utilities.ToolLocationHelper]::
GetPathToStandardLibraries(.NETFramework, netcoreapp3.1;net472, '', '', '', '')" 
cannot be evaluated. Input string was not in a correct format.              

我问了一个相关的问题尝试对此进行故障排除.

I asked a related question to try and troubleshoot this.

推荐答案

我认为您正在寻找<TargetFrameworks>

在这种情况下:

<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>

请注意,您需要使用SDK风格的csproj.我认为这种情况适合您.如果没有,请检查如何使用VS2017升级csproj文件

Please note you need a SDK-style csproj. I assume this in the case for you. If not, check How to upgrade csproj files with VS2017

另请参见

See also the article about <TargetFrameworkVersion>:

本文介绍了指定目标框架的旧方法. SDK风格的项目可以启用不同的TargetFrameworks,例如netstandard.有关更多信息,请参阅目标框架.

This article shows the old way to specify a target framework. SDK-style projects enable different TargetFrameworks like netstandard. For more info, see Target frameworks.

这篇关于在同一项目中目标为V4.7.2和netcoreapp3.1.值未超出预期范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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