title: .Net Core project does not find the SDK or so it seems
body: <p>I am using instructions from <a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-vs-code" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-vs-code</a> to try and build my first Azure Functions project in .Net Core</p>
  
  <p>My problem is I cannot build it:</p>
  
  <pre><code>PS C:\work\proj&gt; dotnet build .\proj.csproj
  Microsoft (R) Build Engine version 16.1.76+g14b0a930a7 for .NET Core
  Copyright (C) Microsoft Corporation. All rights reserved.
  
  c:\Program Files\dotnet\sdk\2.1.4\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets(135,5): error : The current .NET SDK does not support targeting .NET Core 2.1.  Either target .NET Core 2.0 or lower, or use a version of the .NET SDK that supports .NET Core 2.1. [C:\work\proj\proj.csproj]
  
  Build FAILED.
  
  c:\Program Files\dotnet\sdk\2.1.4\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets(135,5): error : The current .NET SDK does not support targeting .NET Core 2.1.  Either target .NET Core 2.0 or lower, or use a version of the .NET SDK that supports .NET Core 2.1. [C:\work\proj\proj.csproj]
      0 Warning(s)
      1 Error(s)
  
  Time Elapsed 00:00:00.56
  PS C:\work\proj&gt;
  </code></pre>
  
  <p>Here is the project file:</p>
  
  <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk"&gt;
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netcoreapp2.1&lt;/TargetFramework&gt;
      &lt;AzureFunctionsVersion&gt;v2&lt;/AzureFunctionsVersion&gt;
    &lt;/PropertyGroup&gt;
    &lt;ItemGroup&gt;
      &lt;PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.28" /&gt;
    &lt;/ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;None Update="host.json"&gt;
        &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;/CopyToOutputDirectory&gt;
      &lt;/None&gt;
      &lt;None Update="local.settings.json"&gt;
        &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;/CopyToOutputDirectory&gt;
        &lt;CopyToPublishDirectory&gt;Never&lt;/CopyToPublishDirectory&gt;
      &lt;/None&gt;
    &lt;/ItemGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  
  <p>I have installed the latest .Net Core SDK from <a href="https://dotnet.microsoft.com/download/thank-you/dotnet-sdk-2.1.700-windows-x64-installer" rel="nofollow noreferrer">https://dotnet.microsoft.com/download/thank-you/dotnet-sdk-2.1.700-windows-x64-installer</a>, so:</p>
  
  <pre><code>PS C:\&gt; dir 'C:\Program Files\dotnet\sdk\'
  
  
      Directory: C:\Program Files\dotnet\sdk
  
  Mode                LastWriteTime         Length Name
  ----                -------------         ------ ----
  d-----          6/7/2018  6:35 PM                1.0.0-preview2-003131
  da----         2/21/2018  7:57 PM                2.1.4
  d-----         10/2/2018  9:04 PM                2.1.403
  d-----         12/3/2018  9:46 AM                2.1.500
  d-----          1/3/2019  9:06 PM                2.1.502
  d-----         5/23/2019  8:18 PM                2.1.507
  d-----         6/30/2019 11:27 PM                2.1.700
  d-----         6/30/2019 11:27 PM                NuGetFallbackFolder
  
  PS C:\&gt;
  </code></pre>
  
  <p>I do not understand why the build selects version 2.1.4. What am I doing wrong?</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>I am pretty sure it is related. For some reason I have environment variable 
  <code>MSBuildSdksPath</code>:</p>
  
  <pre><code>PS C:\&gt; $env:MSBuildSdksPath
  c:\Program Files\dotnet\sdk\2.1.4\Sdks
  PS C:\&gt;
  </code></pre>
  
  <p>Installing the latest SDK did not update it. Why? </p>
  
  <p>Build succeeds when I remove it in the local console. Is it safe to remove it from the environment variables at all?</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <pre><code>PS C:\&gt; dotnet --list-sdks
  1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk]
  2.1.4 [C:\Program Files\dotnet\sdk]
  2.1.403 [C:\Program Files\dotnet\sdk]
  2.1.500 [C:\Program Files\dotnet\sdk]
  2.1.502 [C:\Program Files\dotnet\sdk]
  2.1.507 [C:\Program Files\dotnet\sdk]
  2.1.700 [C:\Program Files\dotnet\sdk]
  PS C:\&gt;
  </code></pre>