src/Microsoft.Crank.Agent/Startup.cs
/// <summary>
/// Retrieves the Current runtime and sdk versions for a tfm
/// </summary>
Retrieves the Current runtime and sdk versions for a tfm
Retrieves the Current runtime and sdk versions for a tfm
private static async Task<(string Runtime, string Desktop, string AspNet, string Sdk)> GetCurrentVersions(string targetFramework)
        {
            if (targetFramework.Equals("net6.0", StringComparison.OrdinalIgnoreCase))
            {
                return (null, null, null, null);
            }
            var frameworkVersion = targetFramework.Substring(targetFramework.Length - 3); 
            var metadataUrl = $"https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/{frameworkVersion}/releases.json";
            try
            {
                var content = await DownloadContentAsync(metadataUrl);
                var index = JObject.Parse(content);
                var aspnet = index.SelectToken($"$.releases[0].aspnetcore-runtime.version").ToString();
                var sdk = index.SelectToken($"$.releases[0].sdk.version").ToString();
                var runtime = index.SelectToken($"$.releases[0].runtime.version").ToString();
                var desktop = index.SelectToken($"$.releases[0].windowsdesktop.version").ToString();
                return (runtime, desktop, aspnet, sdk);
            }
            catch
            {
                Log.WriteLine("Could not load release metadata file for current versions");
                return (null, null, null, null);
            }
        }
private static async Task < ( string Runtime , string Desktop , string AspNet , string Sdk ) > GetCurrentVersions ( string targetFramework ) { if ( targetFramework . Equals ( " " , StringComparison . OrdinalIgnoreCase ) ) { return ( null , null , null , null ) ; } var frameworkVersion = targetFramework . Substring ( targetFramework . Length - 3 ) ; var metadataUrl = $" https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/ { frameworkVersion } /releases.json " ; try { var content = await DownloadContentAsync ( metadataUrl ) ; var index = JObject . Parse ( content ) ; var aspnet = index . SelectToken ( $" $.releases[0].aspnetcore-runtime.version " ) . ToString ( ) ; var sdk = index . SelectToken ( $" $.releases[0].sdk.version " ) . ToString ( ) ; var runtime = index . SelectToken ( $" $.releases[0].runtime.version " ) . ToString ( ) ; var desktop = index . SelectToken ( $" $.releases[0].windowsdesktop.version " ) . ToString ( ) ; return ( runtime , desktop , aspnet , sdk ) ; } catch { Log . WriteLine ( " " ) ; return ( null , null , null , null ) ; } }
Retrieves the Current runtime and sdk versions for a tfm
Retrieves the Current runtime and sdk versions for a tfm
// There are currently no release for net6.0 // Remove once there is at least a preview and a "release-metadata" file // 3.1
targetFramework
string