- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
ToolsVersion 和 TargetFrameworkVersion 有什么区别?
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
......
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
最佳答案
区别在于 TargetFrameworkVersion
实际上有任何影响,而 ToolsVersion
通常完全完全忽略如果你使用的是 VS2013 以上的任何 VS,你的工具链。
正如 Daniel 简洁地指出的那样:
The target framework is for which .net framework features/classes are available to use in your code.
至于 ToolsVersion
(在项目文件的 Project
元素内):
它会被忽略,除非您指定 MSBUILDLEGACYDEFAULTTOOLSVERSION
:请注意 var 名称中的“legacy”。
这实际上在 MSDN 文档中得到了证明,但您必须在版本之间来回跳转并了解背景信息,例如 Compiling for ToolsVersion 12 with Visual Studio 2015也有帮助。
这里是相关的 MSDN 部分:(所有 emph。我的)
MSBuild Toolset (ToolsVersion)
When a ToolsVersion value is defined in a project file, MSBuild uses that value to determine the values of the Toolset properties that are available to the project. One Toolset property is $(MSBuildToolsPath), which specifies the path of the .NET Framework tools. Only that Toolset property (or $(MSBuildBinPath)), is required.
...这实际上是错误的,比较 VS2015 文档和 VS2012 文档,我们看到该段落被复制了下来。
但是,VS2015 文档继续第二段,VS2012 version 中缺少该段:
Starting in Visual Studio 2013, the MSBuild Toolset version is the same as the Visual Studio version number. MSBuild defaults to this Toolset within Visual Studio and on the command line, regardless of the toolset version specified in project file. This behavior can be overridden by using the /ToolsVersion flag. For more information, see Overriding ToolsVersion Settings.
在链接之后,我们看到:
Overriding ToolsVersion Settings
...
Order of Precedence
The order of precedence, from highest to lowest, used to determine the ToolsVersion is:
- The ToolsVersion attribute on the MSBuild task used to build the project, if any.
- The /toolsversion (or /tv) switch that's used in the msbuild.exe command, if any.
- If the environment variable MSBUILDTREATALLTOOLSVERSIONSASCURRENT is set, then use the current ToolsVersion.
If the environment variable MSBUILDTREATHIGHERTOOLSVERSIONASCURRENT is set and the ToolsVersion defined in the project file is greater than the current ToolsVersion, use the current ToolsVersion.
If the environment variable
MSBUILDLEGACYDEFAULTTOOLSVERSION
is set, or if ToolsVersion is not set, then the following steps are used:
- The ToolsVersion attribute of the Project element of the project file. If this attribute doesn’t exist, it is assumed to be the current version.
- The default tools version in the MSBuild.exe.config file.
- The default tools version in the registry. For more information, see Standard and Custom Toolset Configurations.
If the environment variable MSBUILDLEGACYDEFAULTTOOLSVERSION is not set, then the following steps are used:
- If the environment variable MSBUILDDEFAULTTOOLSVERSION is set to a ToolsVersion that exists, use it.
- If DefaultOverrideToolsVersion is set in MSBuild.exe.config, use it.
- If DefaultOverrideToolsVersion is set in the registry, use it.
- Otherwise, use the current ToolsVersion.
请注意,项目文件仅在突出显示的情况下使用。
关于c# - ToolsVersion 和 TargetFrameworkVersion 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22943922/
我无法摆脱上述错误信息。我尝试了 中描述的所有内容 Xamarin forms Android project TargetFrameworkVersion Error after update to
我无法摆脱上述错误信息。我尝试了 中描述的所有内容 Xamarin forms Android project TargetFrameworkVersion Error after update to
错误出现在 visual studio 2017 和 xamarin 上: Severity Code Description Project File Line Suppression State
目前,我已经从 nuget 安装了一些包。我意识到有警告说目标框架大于我在项目中的设置。当我运行我的应用程序时,该应用程序仍在运行。我是否必须根据所需的包更改我的目标框架。如果我保持原样,我的项目还可
我正在尝试使用 CSharpCodeProvider 在运行时编译程序集,我想知道要使用哪个编译器开关来定位目标,例如 .NET Framework 2.0。 最佳答案 你应该能够做这样的事情: Di
我已经下载了 Xamarin Studio 并尝试将 MapsAndLocationDemo3 示例与 MapWithOverlaysActivity 项目一起使用。 我收到以下错误: C:\Prog
在 Visual Studio(v100、v110)中,可以使用项目文件中的 TargetFrameworkVersion 元素指定项目面向的 .NET Framework 版本。 (如果没有 Tar
ToolsVersion 和 TargetFrameworkVersion 有什么区别? ...... v4.5 最佳答案 区别在于 TargetFrameworkVersio
我将旧项目中的 Xamarin.Forms 升级到 v4.5.0.495。当我尝试在 Android 模拟器中启动我的应用程序时,我收到以下错误: XF005:App.Android (v8.1) 的
我们将 .net 3.5 项目 (c#) 升级到 .net 4.0。当您查看项目文件时,我试图理解两个标签: 3.5 4.0 为什么有两个看似相似的标签却具有不同的值? 最佳答案 element 已
当尝试使用 Mono 版本 4.0.2 在 Linux Mint 上的 Visual Studio Code 中使用 .NET 4.5.1 打开控制台项目时,输出窗口中会显示以下警告: /home/f
构建解决方案时,xamarin 抛出此错误。 错误 XA0000:无法确定“v7.1”的 $(TargetFrameworkVersion) 的 API 级别。 如何解决这个错误? 最佳答案 尝试将您
构建 azure 管道时出现错误。在编译目标 api 级别 v12.0 之前它工作正常。现在,我将编译目标更新为 v13.0,它停止构建 Xamarin.Android azure 管道并给出错误 X
构建 azure 管道时出现错误。在编译目标 api 级别 v12.0 之前它工作正常。现在,我将编译目标更新为 v13.0,它停止构建 Xamarin.Android azure 管道并给出错误 X
我是 Xamarin 的新手。我已经安装了带有 Xamarin 组件的 VisualStudio 2017,我的 android sdk 已更新到 Android (v6.0)。我创建了新的 Xama
我是一名优秀的程序员,十分优秀!