@@ -30,17 +30,12 @@ static void Main(string[] args)
3030 new Program ( ) . Execute ( args ) ;
3131 }
3232
33- private readonly CommandOption _defaultTarget ;
3433 private readonly CommandOption _source ;
3534 private readonly CommandOption _output ;
3635 private readonly CommandOption _update ;
3736
3837 public Program ( )
3938 {
40- _defaultTarget = Option (
41- "--default-netcore-target-framework <TFM>" ,
42- "The default .NET Core TFM." ,
43- CommandOptionType . SingleValue ) ;
4439 _source = Option (
4540 "-s|--package-source <SOURCE>" ,
4641 "The NuGet source of packages to fetch" ,
@@ -59,12 +54,6 @@ private async Task<int> Run()
5954 return 1 ;
6055 }
6156
62- if ( ! _defaultTarget . HasValue ( ) )
63- {
64- await Error . WriteLineAsync ( "--default-netcore-target-framework is required." ) ;
65- return 2 ;
66- }
67-
6857 var inputPath = Path . Combine ( Directory . GetCurrentDirectory ( ) , "Baseline.xml" ) ;
6958 var input = XDocument . Load ( inputPath ) ;
7059 var source = _source . HasValue ( ) ? _source . Value ( ) . TrimEnd ( '/' ) : "https://api.nuget.org/v3/index.json" ;
@@ -101,14 +90,18 @@ private async Task<int> Run()
10190
10291 var baselineVersion = input . Root . Attribute ( "Version" ) . Value ;
10392
93+ // Baseline and .NET Core versions always align in non-preview releases.
94+ var parsedVersion = Version . Parse ( baselineVersion ) ;
95+ var defaultTarget = ( ( parsedVersion . Major < 5 ) ? "netcoreapp" : "net" ) +
96+ $ "{ parsedVersion . Major } .{ parsedVersion . Minor } ";
97+
10498 var doc = new XDocument (
10599 new XComment ( " Auto generated. Do not edit manually, use eng/tools/BaselineGenerator/ to recreate. " ) ,
106100 new XElement ( "Project" ,
107101 new XElement ( "PropertyGroup" ,
108102 new XElement ( "MSBuildAllProjects" , "$(MSBuildAllProjects);$(MSBuildThisFileFullPath)" ) ,
109103 new XElement ( "AspNetCoreBaselineVersion" , baselineVersion ) ) ) ) ;
110104
111- var defaultTarget = _defaultTarget . Value ( ) ;
112105 var client = new HttpClient ( ) ;
113106 foreach ( var pkg in input . Root . Descendants ( "Package" ) )
114107 {
0 commit comments