user2657943
user2657943

Reputation: 2758

Azure App Service upgrade dotnet core

My asp.net core site fails to run after publishing. After a bit of troubleshooting I saw the dotnet version on my azure app service was still 1.0.0-rc3-004530. How do I upgrade it to 1.1?

Upvotes: 3

Views: 1249

Answers (1)

Shaun Luttin
Shaun Luttin

Reputation: 141672

Answer

  1. Create a global.json file in your project's root directory.
  2. Set the SDK to a version that is installed both on your machine and on Azure.

Now if your app works locally it will also work remotely. Here is an example global.json file.

{
    "sdk": { "version": "1.0.0-preview2-1-003177" }
}

Explanation

The dotnet --version command does not indicate the .NET Core Runtime version. It is hard to determine which version of the .NET Core SDK is for what version of the .NET Core runtime. What follows is some evidence for that and some ideas on how to make sense of it.

First. Log in to the Azure Portal. Then go to yourapp.scm.azurewebsites.net. Click on Debug Console > PowerShell and run this:

PS> dir "D:\Program Files (x86)\dotnet\sdk" -name

1.0.0-preview1-002702
1.0.0-preview2-003121
1.0.0-preview2-003131
1.0.0-preview2-003156         <-- this is for .NET Core 1.0.3
1.0.0-preview2-1-003177       <-- this is for .NET Core 1.1
1.0.0-preview2.1-003155
1.0.0-preview3-004056
1.0.0-preview4-004233
1.0.0-rc3-004530              <-- this is also for .NET Core 1.1

That is the list of the .NET Core SDK versions installed in Azure. The last one in the list is the one Azure will use by default. The versions all start with 1.0.0.

Second. Do some research at the .NET Core Downloads page. We can find some information about how SDK versions match runtime versions. This is a current download:

Downloading .NET Core 1.1 SDK x86 for Windows

It is downloading the .NET Core 1.1 SDK x86 for Windows; the version number is 1.0.0-preview2-1-003177. (It also happens that 1.0.0-rc3-004530 is for .NET Core 1.1).

Third. From the command line or PowerShell, compare the output of these three commands.

PS> dotnet
PS> dotnet --info
PS> dotnet --version

The first command shows the most relevant information about the version of .NET Core that you are running. The rest give details about the exact version of the SDK.

Summary What does this mean for you? You do not need to upgrade Azure - in Azure you are already using an SDK for .NET Core 1.1. Instead you need to ensure you are using the same SDK version on Azure that you are using locally. My answer shows you how to do that.

Upvotes: 6

Related Questions