.NET SDK version error in microsoft training exercise sandbox

JamesBoggs-4325 0 Reputation points
2024-08-23T11:21:08.1533333+00:00

Tring to run the sandbox exercise "Use shared access signatures to delegate access to Azure Storage" for the Microsoft Certified Azure Administrator Associate certification track, module "Implement and manage storage in Azure", Unit 4 of 7.

Under step 11 Run Your App, after entering the commands:

cd sas

dotnet run

this error appears:

The command could not be loaded, possibly because:

  • You intended to execute a .NET application: The application 'run' does not exist.
  • You intended to execute a .NET SDK command: A compatible .NET SDK was not found.

Requested SDK version: 7.0.400

global.json file: /home/james/sas/global.json

Installed SDKs:

8.0.303 [/usr/share/dotnet/sdk]

Install the [7.0.400] .NET SDK or update [/home/james/sas/global.json] to match an installed SDK.

However Microsoft documentation for .NET 7.0 says: "This release has reached end of life, meaning it is no longer supported. We recommend moving to a supported release, such as 8.0 Runtime.".

And in the sandbox I opened global.json and updated the version to 8.0.303 but that still does not work.

This question is related to the following Learning Module

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
1,479 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. AmaranS 5,860 Reputation points Microsoft Vendor
    2024-08-23T12:49:46.1966667+00:00

    Hi JamesBoggs-4325,

    This is a bug in which the example code provided does not reference the actual installed SDK in the sandbox. Others and I noticed this as well when going through the learn modules and opened pull requests via GitHub.

    You'll need to edit global.json and patient-records.csproj. Feel free to use my pull request edit as a reference, but you'll want to set version in global.json to 7.0.401 in this case. 7.0.400 would also work as in my code, since this will roll forward to the latest installed minor version of the SDK.

    code ~/sas/global.json
    
    {
      "sdk": {
        "version": "7.0.401",
        "rollForward": "latestMinor"
      }
    }
    

    You'll also need to set the target framework to netcoreapp7.0 in patient-records.csproj. I also updated some other package reference versions in my case.

    code ~/sas/patient-records.csproj
    
    <?xml version="1.0" encoding="utf-8"?>
    <Project Sdk="Microsoft.NET.Sdk.Web">
      <PropertyGroup>
        <TargetFramework>netcoreapp7.0</TargetFramework>
        <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
        <RootNamespace>patientrecords</RootNamespace>
      </PropertyGroup>
      <ItemGroup>
        <PackageReference Include="Azure.Identity" Version="1.10.0" />
        <PackageReference Include="Azure.Storage.Blobs" Version="12.17.0" />
        <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="7.0.10" />
      </ItemGroup>
    </Project>
    

    I wouldn't be surprised if this needs to be changed again once .NET 8 is out of preview and possibly installed in the MS Learn sandboxes, but this should run after you update the referenced SDK version and target framework.

    If you are still facing any issue, please let us know in the comments. We are glad to help you.

    If the information is helpful, please click on "Upvote" and "Accept Answer" so that it would be helpful to other community members.

    0 comments No comments

  2. JamesBoggs-4325 0 Reputation points
    2024-08-23T16:13:24.48+00:00

    Thanks I will attempt that.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.