Skip to content

Installing SDK 2.2.1 but no way to update SDK Dependencies from 2.2.0 to 2.2.1 #7014

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

Closed
wstaelens opened this issue Jan 25, 2019 · 15 comments
Closed
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-platform Deprecated: Cross-cutting issues related to ASP.NET Core as a platform ✔️ Resolution: Duplicate Resolved as a duplicate of another issue

Comments

@wstaelens
Copy link

I have SDK 2.2.0, and installed SDK 2.2.103

Now I expected to see or find a way to update the SDK dependencies from version 2.2.0 to 2.2.1, but can't find a way to make this happen.

bug?

image

@wstaelens
Copy link
Author

I have to manually edit the csproj file to change this:

<PackageReference Include="Microsoft.AspNetCore.App" />

to

<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.1" />

@masterjs
Copy link

masterjs commented Jan 25, 2019

@wstaelens this is no longer a recommended approach to set the version to the Microsoft.AspNetCore.App. On my side, I control everything using the global.json. This is the one enforcing the proper SDK.
Hope this helps!
JS

@wstaelens
Copy link
Author

@masterjs I cannot find a "global.json" in my solution or folder?

@masterjs
Copy link

@wstaelens you should read up on it a little bit, its very useful. (https://docs.microsoft.com/en-us/dotnet/core/tools/global-json)
Its not there by default. Add it to the level you desire (I usually put it at the solution level to affect all my aspnetcore projects). It basically enforce that you project will ONLY work with a specific version. Mine has for instance the following:
{ "sdk": { "version": "2.2.100" } }
This mean that my build server and any other dev from the team NEED the SDK version 2.2.100 installed.

thank you,
JS

@wstaelens
Copy link
Author

ok I can follow, but when not using a global.json. How can I ensure the latest version of Microsoft.AspNetCore.App is used from the latest installed SDK?

Like in my case I had SDK 2.2.0, downloaded and installed SDK 2.2.1 but the Microsoft.AspNetCore.App stayed at 2.2.0. Only thing I could do is add a specific version.

Without adding a global.json, is this a bug or is there another solution to not specifying the version number and still using the latest version?

@masterjs
Copy link

Open a dev command line and run dotnet --info . This will tell you the current version of the you're using for real. If you dont have a global.json, your project will usually use the latest SDK version installed on your machine for the 2.2.x version.

@masterjs
Copy link

@wstaelens I also just found this documentation on the MS site that exactly explain how its is "implicitly" getting the right version: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/metapackage-app?view=aspnetcore-2.2

this should answer all your questions!
JS

@wstaelens
Copy link
Author

@masterjs thanks for the info.

... so after installing the latest SDK, I would expected that version 2.2.1 of the Microsoft.AspNetCore.App package would be used (by looking at the SDK Dependencies in the Solution Explorer) if I read that last link. This was not the case. Version 2.2.0 was still being used after installing 2.2.1 and restarting Visual Studio. That is why I've unloaded my project and added a version number manually. Strange… or at least very confusing!
I'll go with the global.json that you provided. I'm sure others will find this topic interesting if I see the number of questions on stackoverflow.

@Eilon Eilon added the feature-platform Deprecated: Cross-cutting issues related to ASP.NET Core as a platform label Jan 26, 2019
@Eilon
Copy link
Contributor

Eilon commented Jan 26, 2019

@natemcmaster - any further thoughts on this?

@natemcmaster natemcmaster added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Jan 26, 2019
@natemcmaster
Copy link
Contributor

any further thoughts on this?

...only that this further justifies why we're refactoring this experience in 3.0. cref #3612

The previous commenters are correct - you do not need to add the version attribute to the PackageReference. Just installing the latest .NET Core SDK or Runtime installers is enough to get 2.2.1. See https://natemcmaster.com/blog/2018/08/29/netcore-primitives-2/ if you want to read more details on this subject.

Closing as a duplicate of dotnet/project-system#3791.

@wstaelens
Copy link
Author

@masterjs @natemcmaster @Eilon ok i've removed the version from the csproj file. added a json file called "global.json" with this info:

{
  "sdk": {
    "version": "2.2.103"
  }
}

and my SDK dependencies still show Microsoft.AspNetCore.App (2.2.0) instead of 2.2.1.

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

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.103\

Host (useful for support):
  Version: 2.2.1
  Commit:  878dd11e62

.NET Core SDKs installed:
  1.0.0-preview1-002702 [C:\Program Files\dotnet\sdk]
  1.0.0-preview2-003121 [C:\Program Files\dotnet\sdk]
  1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk]
  1.0.3 [C:\Program Files\dotnet\sdk]
  1.0.4 [C:\Program Files\dotnet\sdk]
  1.1.0 [C:\Program Files\dotnet\sdk]
  2.0.0 [C:\Program Files\dotnet\sdk]
  2.0.2 [C:\Program Files\dotnet\sdk]
  2.0.3 [C:\Program Files\dotnet\sdk]
  2.1.2 [C:\Program Files\dotnet\sdk]
  2.1.4 [C:\Program Files\dotnet\sdk]
  2.1.100 [C:\Program Files\dotnet\sdk]
  2.1.101 [C:\Program Files\dotnet\sdk]
  2.1.102 [C:\Program Files\dotnet\sdk]
  2.1.103 [C:\Program Files\dotnet\sdk]
  2.1.104 [C:\Program Files\dotnet\sdk]
  2.1.200 [C:\Program Files\dotnet\sdk]
  2.1.201 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.301 [C:\Program Files\dotnet\sdk]
  2.1.400 [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.2.101 [C:\Program Files\dotnet\sdk]
  2.2.102 [C:\Program Files\dotnet\sdk]
  2.2.103 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  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.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  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.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.0-rc2-3002702 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.7 [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.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [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.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

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

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional>

(i tried version numbes 2.2.100, 2.2.1, etc...)
😞

@wstaelens
Copy link
Author

@natemcmaster you closed it, but tell me. I'm still stuck at 2.2.0 now for the Microsoft.AspNetCore.App package.

When i edit the project file and add a version number to it, it is ok, but not recommended, so I removed it again.

I've added a json file called global.json as suggested and added the specific sdk version, but the Microsoft.AspNetCore.App is still at 2.2.0 instead of 2.2.1.
Nuget packages can't be updated as they are "blocked".
So how do I now update the Microsoft.AspNetCore.App SDK dependency from 2.2.0 to 2.2.1 without specifying a version number behind the package, while having the latest SDK installed AND with a global.json file.

@masterjs ?

@natemcmaster
Copy link
Contributor

So how do I now update the Microsoft.AspNetCore.App SDK dependency from 2.2.0 to 2.2.1 without specifying a version number behind the package

You don't need to reference the higher package. I referenced dotnet/project-system#3791 because the UI is misleading. If you have installed the 2.2.1 runtime, your application will automatically rollforward to use it. By default, .NET Core always runs on the highest patch installed on the machine, 2.2.* in your case because you target 'netcoreapp2.2'.

I know this is confusing and breaks the traditional usage of a PackageReference, which is why in .NET Core 3.0, we will no longer be using NuGet to distribute the Microsoft.AspNetCore.App reference. See #3307 and #3612 if you want more details on this subject.

@wstaelens
Copy link
Author

So Visual Studio does not know I'm using sdk 2.2.103 because it shows package 2.2.0 instead of 2.2.1 ?
but still it knows it can't use package 2.2.1 because it is blocked.

very confusing I must say. (and I did not add these nuget packages, can't uninstall or update them).

image

@natemcmaster
Copy link
Contributor

The primary purpose of these 'SDK' package references is to provide the C# compiler with "reference assemblies" (sort of like headers in C#). Unlike most normal packages, Microsoft.AspNetCore.App and Microsoft.NETCore.App do not put more *.dll files in your build output. If you run dotnet publish, you won't see any Microsoft.AspNetCore.*.dll or System.*.dll files in your output. When your application runs, it will find those files in the .NET Core installation (typically in C:\Program Files\dotnet\).

Because of this, the package version is always going to stay at '2.2.0', regardless of which SDK you are using. We don't add new .NET Core APIs in patch releases, and by targeting the 2.2.0 reference, your application will remain compatible with any machine that has .NET Core 2.2 installed. he reason upgrade is blocked from the UI is that it often has unintended consequences. Most users do not need to change this version.

If you would like to read more details on how this works, here are some docs and a blog post I wrote explaining these concepts.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-platform Deprecated: Cross-cutting issues related to ASP.NET Core as a platform ✔️ Resolution: Duplicate Resolved as a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

6 participants