Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build errors in VS2017 after installing VS2019 #3076

Closed
jgunzy opened this issue Apr 4, 2019 · 21 comments
Closed

Build errors in VS2017 after installing VS2019 #3076

jgunzy opened this issue Apr 4, 2019 · 21 comments
Milestone

Comments

@jgunzy
Copy link

jgunzy commented Apr 4, 2019

I have an existing solution containing some projects targeting .Net Core 2.1 and .Net Standard 2.0.

I installed VS2019, and the solution builds. If I open VS2017 and try to build the same solution, I get errors saying:
The current .NET SDK does not support targeting .NET Core 2.1. Either target .NET Core 1.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.1.
and
The current .NET SDK does not support targeting .NET Standard 2.0. Either target .NET Standard 1.6 or lower, or use a version of the .NET SDK that supports .NET Standard 2.0.

This was working before install of VS2019, and still works in VS2019, just not in VS2017.

@peterhuene peterhuene added this to the Discussion milestone Apr 4, 2019
@peterhuene
Copy link
Contributor

@dsplaisted are there any known issues with the SDK resolver that might explain what @jgunzy is experiencing? It looks like 2017 is no longer using a 2.1 SDK after a 2019 install, for some reason.

@v-etzha
Copy link

v-etzha commented Apr 4, 2019

I got the same error after upgrading from 15.9.10 to VS 2017 15.9.11. It worked before the upgrading...
image
And when debugging, the browser came up with an error HTTP Error 502.5 - Process Failure.
image

@dasMulli
Copy link
Contributor

dasMulli commented Apr 4, 2019

Similar things on SO: https://stackoverflow.com/questions/55513335/the-current-net-sdk-does-not-support-targeting-net-core-2-2-sdk-2-2-202 - in this case not being able to taget 2.2

I remember there was some discussion about the installer changing to remove "old" .NET SDK versions from VS.

Could there be a problem that causes VS (2019) updates to remove 2.2.1xx and replace it with 2.2.202 which then no longer allows VS 2017 to resolve to a 2.2.* version that is compatible with its MSBuild 15 distribution?

@jgunzy, @v-etzha could you provide the output of dotnet --info and tell us which VS versions you have and had previously on your machine?

@dbreshears
Copy link

I was able to repro this by removing all the .Net Core > 2.x on my machine. Then Installing latest releases of VS 2017 and VS2019, enabling 2.2 development tools in VS 2019. Then VS 2017 ASP.NET core projects targeting 2.2 fail to build. Here is the dotnet --info

icrosoft Windows [Version 10.0.17763.379]
(c) 2018 Microsoft Corporation. All rights reserved.

dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.2.202
Commit: 8a7ff67

Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.202\

Host (useful for support):
Version: 2.2.3
Commit: 6b8ad509b6

.NET Core SDKs installed:
1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk]
1.1.12 [C:\Program Files\dotnet\sdk]
2.1.505 [C:\Program Files\dotnet\sdk]
2.1.602 [C:\Program Files\dotnet\sdk]
2.2.202 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

@peterhuene
Copy link
Contributor

@dasMulli as far as I'm aware, only the recent previews of .NET Core 3.0 will uninstall previous SDKs, and only back to a certain preview release of the 3.0 SDK. The 2.1 and 2.2 installs should never be touched by the 3.0 installer.

@dbreshears Thanks for the repro. I'm going to take a look and see if I can get my VS 2017 into the same state to investigate.

@peterhuene
Copy link
Contributor

Either @jgunzy or @dbreshears, just to be sure, are you able to build the problematic project from the command line using dotnet build?

@dasMulli
Copy link
Contributor

dasMulli commented Apr 4, 2019

as far as I'm aware, only the recent previews of .NET Core 3.0 will uninstall previous SDKs,

@peterhuene my thoughts exactly but I don't know what the VS installer may decide to do.. if it also tries to do some housekeeping this could lead to problems as well - e.g. not deciding to install 2.2.105 if you have 2.2.202 or "I'm upgrading my dependencies - oh there seem to be some left over that I myself installed previously"
It seems that on another machine I seem to have ended up in a similar situation. I remember hand installing 2.2.105, but all previous versions (e.g. 104) are gone now, but I can't tell when it happened since I used VS 2019 previews exclusively..

@peterhuene
Copy link
Contributor

I haven't yet been able to reproduce. I uninstalled every .NET Core SDK on the system. I reinstalled the .NET Core SDKs via the 2017 (15.9.11) installer; this installed a 2.0 SDK (2.1.202) and a 2.1 SDK (2.1.505).

I was then able to build 2.1 targeted projects. I manually installed SDK 2.2.105 and was then able to build netcoreapp2.2 projects in 2017.

I reinstalled the .NET Core SDKs via the 2019 (16.0.0) installer. This installed 2.2.202 and 2.1.602. Both the previous 2.1 SDK installed by 2017 and the 2.2 SDK I manually installed remained.

I reopened the project in 2017 and was able to build with both a netcoreapp2.2 and a netcoreapp2.1 TFM.

@diedona
Copy link

diedona commented Apr 4, 2019

@peterhuene if you only have the lastest SDK (2.2.202) you will not be able to compile the project through VS 2017. This has happened with me and i needed to install 2.2.105 along so i can build through VS 2017...

https://github.com/dotnet/cli/issues/11072

but i think i have the issue at the wrong place

@dbreshears
Copy link

dbreshears commented Apr 4, 2019

@peterhuene, yes building from the command line succeeds using dotnet build. It seems the only difference is that I did not manually install 2.2.105

@peterhuene
Copy link
Contributor

@diedona that's the correct place for your issue too; ideally we'd have the issues in only dotnet/cli, but it's the same team that owns both repos and we track both issue lists together.

So it appears we're not doing a good job of communicating the fact that 2.1.602 and 2.2.202 require MSBuild 16 and that is only available in 2019. Thus those SDKs aren't getting resolved by 2017 because it uses MSBuild 15.

We recommend anyone running into these issues install the latest 2.1 and 2.2 SDKs that 2017 supports, which is currently 2.1.505 and 2.2.105. 2.1.505 should be installed by the latest VS 2017, but 2.2.105 will need to be installed manually.

If anyone is seeing the 2019 install remove older 2.1 and 2.2 SDKs, please let us know as that should not be happening (that is not what I'm observing either).

I'm working with the team on how we can do a better job of communicating this information to our users.

@peterhuene
Copy link
Contributor

@jgunzy as to your original issue, would you mind providing a dotnet --info? I suspect the only 2.1 SDK you have installed is 2.1.602, which VS 2017 won't use, but I want to confirm.

If that is the case, did you uninstall the 2.1 SDK installed by 2017 manually or did it just disappear on you?

@jgunzy
Copy link
Author

jgunzy commented Apr 4, 2019 via email

@peterhuene
Copy link
Contributor

@jgunzy that's very unexpected. Is there a C:\Program Files\dotnet\sdk\2.1.602 directory or a C:\Program Files (x86)\dotnet\sdk\2.1.602 (the latter would be if you installed a x86 SDK by mistake)?

Do you remember if you had a 2.1.505 SDK installed prior to installing VS 2019?

If you manually install 2.1.505, does it resolve your issue?

@jgunzy
Copy link
Author

jgunzy commented Apr 5, 2019 via email

@jakechristoffersen
Copy link

I haven't yet been able to reproduce. I uninstalled every .NET Core SDK on the system. I reinstalled the .NET Core SDKs via the 2017 (15.9.11) installer; this installed a 2.0 SDK (2.1.202) and a 2.1 SDK (2.1.505).

I was then able to build 2.1 targeted projects. I manually installed SDK 2.2.105 and was then able to build netcoreapp2.2 projects in 2017.

I reinstalled the .NET Core SDKs via the 2019 (16.0.0) installer. This installed 2.2.202 and 2.1.602. Both the previous 2.1 SDK installed by 2017 and the 2.2 SDK I manually installed remained.

I reopened the project in 2017 and was able to build with both a netcoreapp2.2 and a netcoreapp2.1 TFM.

JUST FOLLOW THIS METHOD. I hand installed all of the ones recommended here in order to get it to start working again all 2.2 and 2.1 apps.

@mwpowellhtx
Copy link

I have run into a similar issue. After installing VS2019, in our estimation, for the most part, our VS2017 solution build pipeline works fine. However, is falling over failing to properly identify our internal dotnet CLI tool. This was working seamlessly prior to the side by side installation. The only thing we can figure, is that the latest runtime bits, 3.0, do not function with well with our netcoreapp2.1 targeted dotnet CLI tool.

@mwpowellhtx
Copy link

So... Looking for workarounds, resolutions. Besides potentially need to install and/or re-install SDKs, runtimes, etc. Haven't gotten quite that far in my troubleshooting. Short of that, crude answer is for us to visit each of our .csproj project files and add the ToolsVersion attribute in the appropriate version? I assume that's 15.0 for VS2017? Is there a more elegant way to do that in swath? i.e. through Directory.Build.props, for instance, by convention, as contrasted with by specification?

@mwpowellhtx
Copy link

Well, I've tried adding ToolsVersion="15.0" to our projects, to no avail.

Running the latest NuGet: Version: 5.3.0.6260

If it helps, our dotnet --info looks like this:

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100
 Commit:    04339c3a26

Runtime Environment:
 OS Name:     Windows
 OS Version:  6.1.7601
 OS Platform: Windows
 RID:         win7-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100\

Host (useful for support):
  Version: 3.0.0
  Commit:  7d57652f33

.NET Core SDKs installed:
  2.1.104 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.401 [C:\Program Files\dotnet\sdk]
  2.1.402 [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.503 [C:\Program Files\dotnet\sdk]
  2.1.504 [C:\Program Files\dotnet\sdk]
  2.1.505 [C:\Program Files\dotnet\sdk]
  2.1.507 [C:\Program Files\dotnet\sdk]
  2.1.508 [C:\Program Files\dotnet\sdk]
  2.1.509 [C:\Program Files\dotnet\sdk]
  3.0.100 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

@dsplaisted
Copy link
Member

@mwpowellhtx Can you open a new issue specific to the problems you're having with dotnet CLI tools? This issue has been dormant for 6 months, so I believe it has been resolved and I am going to close it.

@mwpowellhtx
Copy link

mwpowellhtx commented Oct 14, 2019

@dsplaisted Thanks, we have resolved the issue, sort of, but there remains some migration path concerns we'd like to understand better.

dsplaisted pushed a commit to dsplaisted/sdk that referenced this issue Feb 19, 2020
…build 20191004.11 (dotnet#3076)

- Microsoft.NET.Sdk.Razor - 3.0.1-servicing.19504.11
GangWang01 pushed a commit to GangWang01/sdk that referenced this issue Jun 7, 2022
GangWang01 pushed a commit to GangWang01/sdk that referenced this issue Jun 21, 2022
GangWang01 pushed a commit to GangWang01/sdk that referenced this issue Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants