Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 在“上添加了数字比较”$(MSBuildVersion)“;其评估结果为&引用;而不是一个数字,在条件“中”$(MSBuildVersion)>;=16.1.0“)&引用;_Visual Studio - Fatal编程技术网

Visual studio 在“上添加了数字比较”$(MSBuildVersion)“;其评估结果为&引用;而不是一个数字,在条件“中”$(MSBuildVersion)>;=16.1.0“)&引用;

Visual studio 在“上添加了数字比较”$(MSBuildVersion)“;其评估结果为&引用;而不是一个数字,在条件“中”$(MSBuildVersion)>;=16.1.0“)&引用;,visual-studio,Visual Studio,当我尝试重新加载已卸载的项目时,出现此错误,如下面的屏幕截图所示: 它说这行代码来自我的Microsoft.Managed.Core.targets 我试着更新我的NuGet软件包 我尝试将环境变量path值更改为msbuild.exe所在的位置 我试图寻找一种解决方案,将Microsoft.Managed.Core.targets更改为忽略该检查,但我认为这不是一个好的解决方案 失败就发生在这里。我相信这是失败的路线。 下面是我的microsoft managed.core.target

当我尝试重新加载已卸载的项目时,出现此错误,如下面的屏幕截图所示:

它说这行代码来自我的
Microsoft.Managed.Core.targets

  • 我试着更新我的NuGet软件包
  • 我尝试将环境变量path值更改为msbuild.exe所在的位置
  • 我试图寻找一种解决方案,将Microsoft.Managed.Core.targets更改为忽略该检查,但我认为这不是一个好的解决方案
失败就发生在这里。我相信这是失败的路线。 下面是我的
microsoft managed.core.targets

 <Import Project="Microsoft.Managed.EditorConfig.targets" Condition="$(MSBuildVersion) >= 16.1.0" /> 
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (c)  Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <!-- Default this to false until the ".editorconfig in compiler" feature is no longer experimental.
         At that point this PropertyGroup can simply be deleted. -->
    <DiscoverEditorConfigFiles Condition="'$(DiscoverEditorConfigFiles)' == ''">false</DiscoverEditorConfigFiles>



  </PropertyGroup>

  <ItemGroup>
    <PotentialEditorConfigFiles Include="@(Compile->GetPathsOfAllDirectoriesAbove()->Combine('.editorconfig'))" Condition="'$(DiscoverEditorConfigFiles)' != 'false'" />
    <EditorConfigFiles Include="@(PotentialEditorConfigFiles->Exists())" Condition="'$(DiscoverEditorConfigFiles)' != 'false'" />
  </ItemGroup>


</Project>

这也是我同样的错误

尝试对“$(MSBuildVersion)”进行数字比较 在条件“$(MSBuildVersion)>=16.1.0”中,计算结果为“”,而不是数字

我解决这个问题的方法是在VisualStudio中检查更新,并确保我拥有最新版本的VisualStudio

微软的Andy Gocke写道:

The Microsoft.Net.Compilers package requires newer versions of MSBuild as Visual Studio updates, so the 3.1.0 version requires MSBuild version 16.1.

希望这有帮助

我可以通过简单地重新启动Visual Studio来解决此问题

您的计算机上的Microsoft(MS)Build tool不是最新的。您机器上的Visual Studio(VS)2017集成开发环境(IDE)正在寻找MS构建工具版本
16.1.0
。从错误消息中的版本号
16.1.0
可以看出这一点。您应将VS 2017更新至最新版本,以将MS build tool更新至最新版本。当您在计算机上打开VS Installer EXE时,如果您的Visual Studio安装不是最新的,您将在VS 2017部分看到更新按钮,如下面的屏幕截图所示:


单击更新按钮更新VS,VS也将在内部更新MS构建工具。更新安装完成后启动Visual Studio。再次打开解决方案并重新加载当前卸载的项目。现在应该可以加载了。

就这么简单!我也决定了,谢谢