src/Microsoft.Crank.Agent/Startup.cs
/// <summary>
/// Retrieves the runtime version used on ASP.NET Coherence builds
/// </summary>
Retrieves the runtime version used on ASP.NET Coherence builds
Retrieves the runtime version used on ASP . NET Coherence builds
private static async Task<string> GetAspNetRuntimeVersion(string buildToolsPath, string targetFramework)
        {
            var aspNetCoreDependenciesPath = Path.Combine(buildToolsPath, Path.GetFileName(_aspNetCoreDependenciesUrl));
            string latestRuntimeVersion = "";
            switch (targetFramework)
            {
                case "netcoreapp2.1":
                    await DownloadFileAsync(String.Format(_aspNetCoreDependenciesUrl, "release/2.1/build/dependencies.props"), aspNetCoreDependenciesPath, maxRetries: 5, timeout: 10);
                    latestRuntimeVersion = XDocument.Load(aspNetCoreDependenciesPath).Root
                        .Elements("PropertyGroup")
                        .Select(x => x.Element("MicrosoftNETCoreAppPackageVersion"))
                        .Where(x => x != null)
                        .FirstOrDefault()
                        .Value;
                    break;
                case "netcoreapp2.2":
                    await DownloadFileAsync(String.Format(_aspNetCoreDependenciesUrl, "release/2.2/build/dependencies.props"), aspNetCoreDependenciesPath, maxRetries: 5, timeout: 10);
                    latestRuntimeVersion = XDocument.Load(aspNetCoreDependenciesPath).Root
                        .Elements("PropertyGroup")
                        .Select(x => x.Element("MicrosoftNETCoreAppPackageVersion"))
                        .Where(x => x != null)
                        .FirstOrDefault()
                        .Value;
                    break;
                case "netcoreapp3.0":
                    await DownloadFileAsync(String.Format(_aspNetCoreDependenciesUrl, "release/3.0/eng/Versions.props"), aspNetCoreDependenciesPath, maxRetries: 5, timeout: 10);
                    latestRuntimeVersion = XDocument.Load(aspNetCoreDependenciesPath).Root
                        .Elements("PropertyGroup")
                        .Select(x => x.Element("MicrosoftNETCoreAppRefPackageVersion"))
                        .Where(x => x != null)
                        .FirstOrDefault()
                        .Value;
                    break;
                case "netcoreapp3.1":
                    await DownloadFileAsync(String.Format(_aspNetCoreDependenciesUrl, "release/3.1/eng/Versions.props"), aspNetCoreDependenciesPath, maxRetries: 5, timeout: 10);
                    latestRuntimeVersion = XDocument.Load(aspNetCoreDependenciesPath).Root
                        .Elements("PropertyGroup")
                        .Select(x => x.Element("MicrosoftNETCoreAppRuntimewinx64PackageVersion"))
                        .Where(x => x != null)
                        .FirstOrDefault()
                        .Value;
                    break;
                case "netcoreapp5.0":
                case "net5.0":
                    await DownloadFileAsync(String.Format(_aspNetCoreDependenciesUrl, "main/5.0/Versions.props"), aspNetCoreDependenciesPath, maxRetries: 5, timeout: 10);
                    latestRuntimeVersion = XDocument.Load(aspNetCoreDependenciesPath).Root
                        .Elements("PropertyGroup")
                        .Select(x => x.Element("MicrosoftNETCoreAppRuntimewinx64PackageVersion"))
                        .Where(x => x != null)
                        .FirstOrDefault()
                        .Value;
                    break;
                case "net6.0":
                    await DownloadFileAsync(String.Format(_aspNetCoreDependenciesUrl, "main/eng/Versions.props"), aspNetCoreDependenciesPath, maxRetries: 5, timeout: 10);
                    latestRuntimeVersion = XDocument.Load(aspNetCoreDependenciesPath).Root
                        .Elements("PropertyGroup")
                        .Select(x => x.Element("MicrosoftNETCoreAppRuntimewinx64PackageVersion"))
                        .Where(x => x != null)
                        .FirstOrDefault()
                        .Value;
                    break;
            }
            Log.WriteLine($"Detecting AspNetCore repository runtime version: {latestRuntimeVersion}");
            return latestRuntimeVersion;
        }
private static async Task < string > GetAspNetRuntimeVersion ( string buildToolsPath , string targetFramework ) { var aspNetCoreDependenciesPath = Path . Combine ( buildToolsPath , Path . GetFileName ( _aspNetCoreDependenciesUrl ) ) ; string latestRuntimeVersion = " " ; switch ( targetFramework ) { case " " : await DownloadFileAsync ( String . Format ( _aspNetCoreDependenciesUrl , " " ) , aspNetCoreDependenciesPath , maxRetries : 5 , timeout : 10 ) ; latestRuntimeVersion = XDocument . Load ( aspNetCoreDependenciesPath ) . Root . Elements ( " " ) . Select ( x => x . Element ( " " ) ) . Where ( x => x != null ) . FirstOrDefault ( ) . Value ; break ; case " " : await DownloadFileAsync ( String . Format ( _aspNetCoreDependenciesUrl , " " ) , aspNetCoreDependenciesPath , maxRetries : 5 , timeout : 10 ) ; latestRuntimeVersion = XDocument . Load ( aspNetCoreDependenciesPath ) . Root . Elements ( " " ) . Select ( x => x . Element ( " " ) ) . Where ( x => x != null ) . FirstOrDefault ( ) . Value ; break ; case " " : await DownloadFileAsync ( String . Format ( _aspNetCoreDependenciesUrl , " " ) , aspNetCoreDependenciesPath , maxRetries : 5 , timeout : 10 ) ; latestRuntimeVersion = XDocument . Load ( aspNetCoreDependenciesPath ) . Root . Elements ( " " ) . Select ( x => x . Element ( " " ) ) . Where ( x => x != null ) . FirstOrDefault ( ) . Value ; break ; case " " : await DownloadFileAsync ( String . Format ( _aspNetCoreDependenciesUrl , " " ) , aspNetCoreDependenciesPath , maxRetries : 5 , timeout : 10 ) ; latestRuntimeVersion = XDocument . Load ( aspNetCoreDependenciesPath ) . Root . Elements ( " " ) . Select ( x => x . Element ( " " ) ) . Where ( x => x != null ) . FirstOrDefault ( ) . Value ; break ; case " " : case " " : await DownloadFileAsync ( String . Format ( _aspNetCoreDependenciesUrl , " " ) , aspNetCoreDependenciesPath , maxRetries : 5 , timeout : 10 ) ; latestRuntimeVersion = XDocument . Load ( aspNetCoreDependenciesPath ) . Root . Elements ( " " ) . Select ( x => x . Element ( " " ) ) . Where ( x => x != null ) . FirstOrDefault ( ) . Value ; break ; case " " : await DownloadFileAsync ( String . Format ( _aspNetCoreDependenciesUrl , " " ) , aspNetCoreDependenciesPath , maxRetries : 5 , timeout : 10 ) ; latestRuntimeVersion = XDocument . Load ( aspNetCoreDependenciesPath ) . Root . Elements ( " " ) . Select ( x => x . Element ( " " ) ) . Where ( x => x != null ) . FirstOrDefault ( ) . Value ; break ; } Log . WriteLine ( $" Detecting AspNetCore repository runtime version:  { latestRuntimeVersion } " ) ; return latestRuntimeVersion ; }
Retrieves the runtime version used on ASP.NET Coherence builds
Retrieves the runtime version used on ASP . NET Coherence builds
buildToolsPath
string
targetFramework
string