diff --git a/eng/Packages.props b/eng/Packages.props index d76eaf4c8665..58b3c3f3a5f2 100644 --- a/eng/Packages.props +++ b/eng/Packages.props @@ -4,9 +4,10 @@ - - + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 20df0248d211..b0b39ec205c1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,62 +1,62 @@ - + - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 @@ -64,166 +64,166 @@ https://github.com/dotnet/core-setup 7d57652f33493fa022125b7f63aad0d70c52d810 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - + https://github.com/nuget/nuget.client - c21ba3b47e224cf84490bdc53b89e7f9ebcc1841 + 795d8b1beea2359a394e30d21f5faddbd3788ac7 - - https://github.com/microsoft/vstest - ab6e14292ec4aac0c228a6c75e420f0a0461b0e1 + + https://github.com/dotnet/dotnet + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - - https://github.com/microsoft/vstest - ab6e14292ec4aac0c228a6c75e420f0a0461b0e1 + + https://github.com/dotnet/dotnet + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - - https://github.com/microsoft/vstest - ab6e14292ec4aac0c228a6c75e420f0a0461b0e1 + + https://github.com/dotnet/dotnet + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - - https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 - - - https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 - - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 https://github.com/dotnet/arcade-services @@ -569,9 +561,9 @@ https://github.com/microsoft/testfx 62a0339db2a558ec8bb67f9f17fe6491ccd56c5b - + https://github.com/dotnet/dotnet - f451e5d3036a4f140a989e0a7f3f1ae432420e71 + 699b0116eb3df66c4dd7698af4f1cd24ac4547a3 diff --git a/eng/Versions.props b/eng/Versions.props index 49a94b1542ed..49b3f3f26bf9 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -54,7 +54,7 @@ https://dotnetclimsrc.blob.core.windows.net/dotnet/ - 3.2.0-preview.25359.101 + 3.2.0-preview.25367.101 1.0.0-20230414.1 2.23.0 2.0.1-servicing-26011-01 @@ -63,7 +63,7 @@ 4.8.6 1.2.0-beta.435 4.0.5 - 2.0.0-beta6.25359.101 + 2.0.0-beta7.25367.101 2.0.0-beta5.25279.2 1.1.2-beta1.22216.1 10.3.0 @@ -81,11 +81,11 @@ - 2.0.0-preview.1.25359.101 + 2.0.0-preview.1.25367.101 - 2.2.0-beta.25359.101 + 2.2.0-beta.25367.101 @@ -97,40 +97,40 @@ - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 8.0.0-rc.1.23414.4 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 2.1.0 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 8.0.0 @@ -146,28 +146,28 @@ - 7.0.0-preview.1.28 - 7.0.0-preview.1.28 - 7.0.0-preview.1.28 - 7.0.0-preview.1.28 - 7.0.0-preview.1.28 - 7.0.0-preview.1.28 - 7.0.0-preview.1.28 - 7.0.0-preview.1.28 - 7.0.0-preview.1.28 - 7.0.0-preview.1.28 - 7.0.0-preview.1.28 - 7.0.0-preview.1.28 + 7.0.0-preview.1.46 + 7.0.0-preview.1.46 + 7.0.0-preview.1.46 + 7.0.0-preview.1.46 + 7.0.0-preview.1.46 + 7.0.0-preview.1.46 + 7.0.0-preview.1.46 + 7.0.0-preview.1.46 + 7.0.0-preview.1.46 + 7.0.0-preview.1.46 + 7.0.0-preview.1.46 + 7.0.0-preview.1.46 - 18.0.0-preview-25366-05 - 18.0.0-preview-25366-05 - 18.0.0-preview-25366-05 + 18.0.0-preview-25367-101 + 18.0.0-preview-25367-101 + 18.0.0-preview-25367-101 - 10.0.0-preview.25359.101 + 10.0.0-preview.25367.101 @@ -188,82 +188,84 @@ At usage sites, either we use MicrosoftBuildMinimumVersion, or MicrosoftBuildVersion in source-only modes. Additionally, set the MinimumVSVersion for the installer UI that's required for targeting NetCurrent --> - 17.15.0-preview-25359-101 - 17.15.0-preview-25359-101 + 17.15.0-preview-25367-101 + 17.15.0-preview-25367-101 17.11.4 17.13 - 10.0.100-preview.7.25359.101 - 10.0.100-preview.7.25359.101 - 10.0.100-preview.7.25359.101 - 10.0.100-preview.7.25359.101 - 10.0.100-preview.7.25359.101 + 10.0.100-preview.7.25367.101 + 10.0.100-preview.7.25367.101 + 10.0.100-preview.7.25367.101 + 10.0.100-preview.7.25367.101 + 10.0.100-preview.7.25367.101 - 10.0.100-preview.7.25359.101 - 10.0.100-preview.7.25359.101 - 10.0.100-preview.7.25359.101 - 10.0.100-preview.7.25359.101 + 10.0.100-preview.7.25367.101 + 10.0.100-preview.7.25367.101 + 10.0.100-preview.7.25367.101 + 10.0.100-preview.7.25367.101 - 14.0.100-preview7.25359.101 + 14.0.100-preview7.25367.101 - 5.0.0-1.25359.101 - 5.0.0-1.25359.101 - 5.0.0-1.25359.101 - 5.0.0-1.25359.101 - 5.0.0-1.25359.101 - 5.0.0-1.25359.101 - 5.0.0-1.25359.101 - 5.0.0-1.25359.101 - 5.0.0-1.25359.101 - 5.0.0-1.25359.101 + 5.0.0-2.25367.101 + 5.0.0-2.25367.101 + 5.0.0-2.25367.101 + 5.0.0-2.25367.101 + 5.0.0-2.25367.101 + 5.0.0-2.25367.101 + 5.0.0-2.25367.101 + 5.0.0-2.25367.101 + 5.0.0-2.25367.101 + 5.0.0-2.25367.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.5.25265.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.5.25265.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 - 10.0.0-preview.25359.101 - 10.0.0-preview.25359.101 - 10.0.0-preview.25359.101 + 10.0.0-preview.25367.101 + 10.0.0-preview.25367.101 + 10.0.0-preview.25367.101 - 10.0.0-preview.7.25359.101 - 10.0.0-preview.7.25359.101 + 10.0.0-preview.7.25367.101 + 10.0.0-preview.7.25367.101 3.1.56 3.1.56 @@ -271,6 +273,10 @@ 3.1.12 2.0.23 + + + 10.0.0-preview.7.25367.101 + 2.2.0-beta.19072.10 10.0.0-preview.24602.1 @@ -282,21 +288,21 @@ - 10.0.0-beta.25359.101 - 10.0.0-beta.25359.101 - 10.0.0-beta.25359.101 - 10.0.0-beta.25359.101 - 10.0.0-beta.25359.101 - 10.0.0-beta.25359.101 + 10.0.0-beta.25367.101 + 10.0.0-beta.25367.101 + 10.0.0-beta.25367.101 + 10.0.0-beta.25367.101 + 10.0.0-beta.25367.101 + 10.0.0-beta.25367.101 - 10.0.0-beta.25359.101 - 10.0.0-beta.25359.101 - 10.0.0-beta.25359.101 - 10.0.0-beta.25359.101 - 10.0.0-beta.25359.101 - 10.0.0-beta.25359.101 + 10.0.0-beta.25367.101 + 10.0.0-beta.25367.101 + 10.0.0-beta.25367.101 + 10.0.0-beta.25367.101 + 10.0.0-beta.25367.101 + 10.0.0-beta.25367.101 diff --git a/eng/dependabot/Packages.props b/eng/dependabot/Packages.props index 01557464a3c4..76181ba6cfc0 100644 --- a/eng/dependabot/Packages.props +++ b/eng/dependabot/Packages.props @@ -4,9 +4,10 @@ - - + + + diff --git a/global.json b/global.json index 25e8fb7086a7..dd1d8aae7e5a 100644 --- a/global.json +++ b/global.json @@ -7,7 +7,7 @@ "errorMessage": "The .NET SDK is not installed or is not configured correctly. Please run ./build to install the correct SDK version locally." }, "tools": { - "dotnet": "10.0.100-preview.7.25322.101", + "dotnet": "10.0.100-preview.7.25367.101", "runtimes": { "dotnet": [ "$(MicrosoftNETCorePlatformsPackageVersion)" @@ -21,8 +21,8 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25359.101", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25359.101", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25367.101", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25367.101", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0" } diff --git a/src/BuiltInTools/dotnet-format/Commands/FormatCommandCommon.cs b/src/BuiltInTools/dotnet-format/Commands/FormatCommandCommon.cs index 7152fb346d8a..64548392e484 100644 --- a/src/BuiltInTools/dotnet-format/Commands/FormatCommandCommon.cs +++ b/src/BuiltInTools/dotnet-format/Commands/FormatCommandCommon.cs @@ -164,18 +164,18 @@ public static FormatOptions ParseVerbosityOption(this ParseResult parseResult, F public static FormatOptions ParseCommonOptions(this ParseResult parseResult, FormatOptions formatOptions, ILogger logger) { - if (parseResult.GetResult(NoRestoreOption) is not null) + if (parseResult.GetValue(NoRestoreOption)) { formatOptions = formatOptions with { NoRestore = true }; } - if (parseResult.GetResult(VerifyNoChanges) is not null) + if (parseResult.GetValue(VerifyNoChanges)) { formatOptions = formatOptions with { ChangesAreErrors = true }; formatOptions = formatOptions with { SaveFormattedFiles = false }; } - if (parseResult.GetResult(IncludeGeneratedOption) is not null) + if (parseResult.GetValue(IncludeGeneratedOption)) { formatOptions = formatOptions with { IncludeGeneratedFiles = true }; } @@ -300,7 +300,7 @@ public static FormatOptions ParseWorkspaceOptions(this ParseResult parseResult, if (parseResult.GetValue(SlnOrProjectArgument) is string { Length: > 0 } slnOrProject) { - if (parseResult.GetResult(FolderOption) is not null) + if (parseResult.GetValue(FolderOption)) { formatOptions = formatOptions with { WorkspaceFilePath = slnOrProject }; formatOptions = formatOptions with { WorkspaceType = WorkspaceType.Folder }; diff --git a/src/BuiltInTools/dotnet-format/Commands/FormatWhitespaceCommand.cs b/src/BuiltInTools/dotnet-format/Commands/FormatWhitespaceCommand.cs index b5179f379ef1..a8a15b6b140c 100644 --- a/src/BuiltInTools/dotnet-format/Commands/FormatWhitespaceCommand.cs +++ b/src/BuiltInTools/dotnet-format/Commands/FormatWhitespaceCommand.cs @@ -28,8 +28,8 @@ internal static Command GetCommand() internal static void EnsureFolderNotSpecifiedWithNoRestore(CommandResult symbolResult) { var folder = symbolResult.GetValue(FolderOption); - var noRestore = symbolResult.GetResult(NoRestoreOption); - if (folder && noRestore != null) + var noRestore = symbolResult.GetValue(NoRestoreOption); + if (folder && noRestore) { symbolResult.AddError(Resources.Cannot_specify_the_folder_option_with_no_restore); } diff --git a/src/BuiltInTools/dotnet-format/Program.cs b/src/BuiltInTools/dotnet-format/Program.cs index a6109488c6e4..fc893759206b 100644 --- a/src/BuiltInTools/dotnet-format/Program.cs +++ b/src/BuiltInTools/dotnet-format/Program.cs @@ -9,7 +9,7 @@ internal class Program private static async Task Main(string[] args) { var rootCommand = RootFormatCommand.GetCommand(); - return await rootCommand.Parse(args).InvokeAsync(CancellationToken.None); + return await rootCommand.Parse(args).InvokeAsync(null, CancellationToken.None); } } } diff --git a/src/BuiltInTools/dotnet-watch/CommandLine/CommandLineOptions.cs b/src/BuiltInTools/dotnet-watch/CommandLine/CommandLineOptions.cs index c1cd864aca4b..b8dc3a12003e 100644 --- a/src/BuiltInTools/dotnet-watch/CommandLine/CommandLineOptions.cs +++ b/src/BuiltInTools/dotnet-watch/CommandLine/CommandLineOptions.cs @@ -43,7 +43,7 @@ internal sealed class CommandLineOptions verboseOption.Validators.Add(v => { - if (v.GetResult(quietOption) is not null && v.GetResult(verboseOption) is not null) + if (v.GetValue(quietOption) && v.GetValue(verboseOption)) { v.AddError(Resources.Error_QuietAndVerboseSpecified); } @@ -90,17 +90,14 @@ internal sealed class CommandLineOptions var rootCommandInvoked = false; rootCommand.SetAction(parseResult => rootCommandInvoked = true); - var cliConfig = new CommandLineConfiguration(rootCommand) + ParserConfiguration parseConfig = new() { - Output = output, - Error = output, - // To match dotnet command line parsing (see https://github.com/dotnet/sdk/blob/4712b35b94f2ad672e69ec35097cf86fc16c2e5e/src/Cli/dotnet/Parser.cs#L169): EnablePosixBundling = false, }; // parse without forwarded options first: - var parseResult = rootCommand.Parse(args, cliConfig); + var parseResult = rootCommand.Parse(args, parseConfig); if (ReportErrors(parseResult, reporter)) { errorCode = 1; @@ -118,7 +115,7 @@ internal sealed class CommandLineOptions } // reparse with forwarded options: - parseResult = rootCommand.Parse(args, cliConfig); + parseResult = rootCommand.Parse(args, parseConfig); if (ReportErrors(parseResult, reporter)) { errorCode = 1; @@ -126,7 +123,11 @@ internal sealed class CommandLineOptions } // invoke to execute default actions for displaying help - errorCode = parseResult.Invoke(); + errorCode = parseResult.Invoke(new() + { + Output = output, + Error = output + }); if (!rootCommandInvoked) { // help displayed: @@ -192,9 +193,15 @@ private static IReadOnlyList GetCommandArguments( continue; } + // skip Option zero-arity options with an implicit optionresult - these weren't actually specified by the user: + if (optionResult.Option is Option boolOpt && boolOpt.Arity.Equals(ArgumentArity.Zero) && optionResult.Implicit) + { + continue; + } + // Some options _may_ be computed or have defaults, so not all may have an IdentifierToken. - // For those that do not, use the Option's Name instead. - var optionNameToForward = optionResult.IdentifierToken?.Value ?? optionResult.Option.Name; + // For those that do not, use the Option's Name instead. + var optionNameToForward = optionResult.IdentifierToken?.Value ?? optionResult.Option.Name; if (optionResult.Tokens.Count == 0 && !optionResult.Implicit) { arguments.Add(optionNameToForward); diff --git a/src/BuiltInTools/dotnet-watch/HotReload/IncrementalMSBuildWorkspace.cs b/src/BuiltInTools/dotnet-watch/HotReload/IncrementalMSBuildWorkspace.cs index 936b2485455e..86c44aab759c 100644 --- a/src/BuiltInTools/dotnet-watch/HotReload/IncrementalMSBuildWorkspace.cs +++ b/src/BuiltInTools/dotnet-watch/HotReload/IncrementalMSBuildWorkspace.cs @@ -18,6 +18,7 @@ internal class IncrementalMSBuildWorkspace : Workspace public IncrementalMSBuildWorkspace(IReporter reporter) : base(MSBuildMefHostServices.DefaultServices, WorkspaceKind.MSBuild) { +#pragma warning disable CS0618 // https://github.com/dotnet/sdk/issues/49725 WorkspaceFailed += (_sender, diag) => { // Report both Warning and Failure as warnings. @@ -26,6 +27,7 @@ public IncrementalMSBuildWorkspace(IReporter reporter) // https://github.com/dotnet/roslyn/issues/75170 reporter.Warn($"msbuild: {diag.Diagnostic}", "⚠"); }; +#pragma warning restore CS0618 _reporter = reporter; } diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildArgs.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildArgs.cs index 1f7ff9e3e856..db8febad9650 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildArgs.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildArgs.cs @@ -45,6 +45,14 @@ private MSBuildArgs(ReadOnlyDictionary? properties, ReadOnlyDict /// public List OtherMSBuildArgs { get; } + /// + /// Ensures that when we do our MSBuild-property re-parses we parse in the same way as the dotnet CLI's parser. + /// + private static readonly ParserConfiguration _analysisParsingConfiguration = new() + { + EnablePosixBundling = false + }; + /// /// Takes all of the unstructured properties and arguments that have been accrued from the command line /// processing of the SDK and returns a structured set of MSBuild arguments grouped by purpose. @@ -58,12 +66,8 @@ public static MSBuildArgs AnalyzeMSBuildArguments(IEnumerable forwardedA { fakeCommand.Options.Add(option); } - - var propertyParsingConfiguration = new CommandLineConfiguration(fakeCommand) - { - EnablePosixBundling = false - }; - var parseResult = propertyParsingConfiguration.Parse([..forwardedAndUserFacingArgs]); +; + var parseResult = fakeCommand.Parse([.. forwardedAndUserFacingArgs], _analysisParsingConfiguration); var globalProperties = parseResult.GetResult("--property") is OptionResult propResult ? propResult.GetValueOrDefault?>() : null; var restoreProperties = parseResult.GetResult("--restoreProperty") is OptionResult restoreResult ? restoreResult.GetValueOrDefault?>() : null; var requestedTargets = parseResult.GetResult("--target") is OptionResult targetResult ? targetResult.GetValueOrDefault() : null; diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj b/src/Cli/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj index 115f5dd125ec..97bfea50c794 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj @@ -32,7 +32,7 @@ for Mac and other VS scenarios. During source-build, we only have access to the latest version, which targets NetCurrent. --> - $(PkgMicrosoft_Build_Runtime)\contentFiles\any\net9.0\MSBuild.dll + $(PkgMicrosoft_Build_Runtime)\contentFiles\any\net10.0\MSBuild.dll $(PkgMicrosoft_Build_Runtime)\contentFiles\any\$(NetCurrent)\MSBuild.dll diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/ParserFactory.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/ParserFactory.cs index bf19f440af4d..60f04af43e02 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/ParserFactory.cs +++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/ParserFactory.cs @@ -8,35 +8,22 @@ namespace Microsoft.TemplateEngine.Cli.Commands { internal static class ParserFactory { - internal static CommandLineConfiguration CreateParser(Command command, bool disableHelp = false) + internal static readonly ParserConfiguration ParserConfiguration = new() { - CommandLineConfiguration config = new(command) - //TODO: decide if it's needed to implement it; and implement if needed - //.UseParseDirective() - //.UseSuggestDirective() - { - EnablePosixBundling = false - }; - - for (int i = 0; i < command.Options.Count; i++) - { - if (command.Options[i] is HelpOption) - { - if (disableHelp) - { - command.Options.RemoveAt(i); - } + EnablePosixBundling = false, + }; - return config; - } - } + internal static Command CreateParser(Command command, bool disableHelp = false) + { + // { + // EnablePosixBundling = false + // }; if (!disableHelp) { command.Options.Add(new HelpOption()); } - - return config; + return command; } } } diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.TabCompletion.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.TabCompletion.cs index 8056bb028fd3..ca0f5c881cf9 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.TabCompletion.cs +++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.TabCompletion.cs @@ -60,11 +60,11 @@ internal static IEnumerable GetTemplateCompletions( templateGroup, template); - CommandLineConfiguration parser = ParserFactory.CreateParser(command); + System.CommandLine.Command parser = ParserFactory.CreateParser(command); //it is important to pass raw text to get the completion //completions for args passed as array are not supported - ParseResult parseResult = parser.Parse(context.CommandLineText); + ParseResult parseResult = parser.Parse(context.CommandLineText, ParserFactory.ParserConfiguration); foreach (CompletionItem completion in parseResult.GetCompletions(context.CursorPosition)) { ////TODO: conditionals tab completion here diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.cs index c8af9158f0ef..7889716ea67b 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.cs +++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.cs @@ -435,8 +435,8 @@ private static (TemplateCommand? Command, ParseResult? ParseResult)? ReparseForT template, validateDefaultLanguage); - CommandLineConfiguration parser = ParserFactory.CreateParser(command); - ParseResult parseResult = parser.Parse(args.RemainingArguments ?? Array.Empty()); + System.CommandLine.Command parser = ParserFactory.CreateParser(command); + ParseResult parseResult = parser.Parse(args.RemainingArguments ?? Array.Empty(), ParserFactory.ParserConfiguration); return (command, parseResult); } catch (InvalidTemplateParametersException e) diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Help/DotnetHelpAction.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Help/DotnetHelpAction.cs index f4c5b2664fff..b12a85faeaa5 100644 --- a/src/Cli/Microsoft.TemplateEngine.Cli/Help/DotnetHelpAction.cs +++ b/src/Cli/Microsoft.TemplateEngine.Cli/Help/DotnetHelpAction.cs @@ -25,7 +25,7 @@ public HelpBuilder Builder /// public override int Invoke(ParseResult parseResult) { - var output = parseResult.Configuration.Output; + var output = parseResult.InvocationConfiguration.Output; var helpContext = new HelpContext( Builder, diff --git a/src/Cli/dotnet/Commands/Build/BuildCommand.cs b/src/Cli/dotnet/Commands/Build/BuildCommand.cs index fb17a4db1b61..871ead794e84 100644 --- a/src/Cli/dotnet/Commands/Build/BuildCommand.cs +++ b/src/Cli/dotnet/Commands/Build/BuildCommand.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.CommandLine; @@ -12,8 +12,7 @@ public static class BuildCommand { public static CommandBase FromArgs(string[] args, string? msbuildPath = null) { - var parser = Parser.Instance; - var parseResult = parser.ParseFrom("dotnet build", args); + var parseResult = Parser.Parse(["dotnet", "build", ..args]); return FromParseResult(parseResult, msbuildPath); } @@ -22,10 +21,10 @@ public static CommandBase FromParseResult(ParseResult parseResult, string? msbui parseResult.ShowHelpOrErrorIfAppropriate(); CommonOptions.ValidateSelfContainedOptions( - parseResult.GetResult(BuildCommandParser.SelfContainedOption) is not null, - parseResult.GetResult(BuildCommandParser.NoSelfContainedOption) is not null); + parseResult.HasOption(BuildCommandParser.SelfContainedOption), + parseResult.HasOption(BuildCommandParser.NoSelfContainedOption)); - bool noRestore = parseResult.GetResult(BuildCommandParser.NoRestoreOption) is not null; + bool noRestore = parseResult.HasOption(BuildCommandParser.NoRestoreOption); return CommandFactory.CreateVirtualOrPhysicalCommand( BuildCommandParser.GetCommand(), diff --git a/src/Cli/dotnet/Commands/Clean/CleanCommand.cs b/src/Cli/dotnet/Commands/Clean/CleanCommand.cs index ef6f964a8cb4..1290b8b68cfd 100644 --- a/src/Cli/dotnet/Commands/Clean/CleanCommand.cs +++ b/src/Cli/dotnet/Commands/Clean/CleanCommand.cs @@ -13,8 +13,7 @@ public class CleanCommand(MSBuildArgs msbuildArgs, string? msbuildPath = null) : { public static CommandBase FromArgs(string[] args, string? msbuildPath = null) { - var parser = Parser.Instance; - var result = parser.ParseFrom("dotnet clean", args); + var result = Parser.Parse(["dotnet", "clean", ..args]); return FromParseResult(result, msbuildPath); } diff --git a/src/Cli/dotnet/Commands/Format/FormatCommand.cs b/src/Cli/dotnet/Commands/Format/FormatCommand.cs index dc50385c6a17..9ee9296172fa 100644 --- a/src/Cli/dotnet/Commands/Format/FormatCommand.cs +++ b/src/Cli/dotnet/Commands/Format/FormatCommand.cs @@ -13,8 +13,7 @@ public class FormatCommand(IEnumerable argsToForward) : FormatForwarding { public static FormatCommand FromArgs(string[] args) { - var parser = Parser.Instance; - var result = parser.ParseFrom("dotnet format", args); + var result = Parser.Parse(["dotnet", "format", ..args]); return FromParseResult(result); } diff --git a/src/Cli/dotnet/Commands/Help/HelpCommand.cs b/src/Cli/dotnet/Commands/Help/HelpCommand.cs index 48a67237282a..416516aa9d9e 100644 --- a/src/Cli/dotnet/Commands/Help/HelpCommand.cs +++ b/src/Cli/dotnet/Commands/Help/HelpCommand.cs @@ -105,7 +105,7 @@ public int Execute() private static bool TryGetDocsLink(string[] command, out string docsLink) { - var parsedCommand = Parser.Instance.Parse(["dotnet", .. command]); + var parsedCommand = Parser.Parse(["dotnet", .. command]); if (parsedCommand?.CommandResult?.Command is ICommandDocument dc) { docsLink = dc.DocsLink; diff --git a/src/Cli/dotnet/Commands/Hidden/Complete/CompleteCommand.cs b/src/Cli/dotnet/Commands/Hidden/Complete/CompleteCommand.cs index 1e3755207963..5cdf66cfca6e 100644 --- a/src/Cli/dotnet/Commands/Hidden/Complete/CompleteCommand.cs +++ b/src/Cli/dotnet/Commands/Hidden/Complete/CompleteCommand.cs @@ -19,8 +19,7 @@ public static int Run(ParseResult parseResult) public static int RunWithReporter(string[] args, IReporter reporter) { - var parser = Parser.Instance; - var result = parser.ParseFrom("dotnet complete", args); + var result = Parser.Parse(["dotnet", "complete", ..args]); return RunWithReporter(result, reporter); } @@ -61,7 +60,7 @@ private static CompletionItem[] Completions(ParseResult complete) input += " "; } - var result = Parser.Instance.Parse(input); + var result = Parser.Parse(input); return [.. result.GetCompletions(position).Distinct()]; } diff --git a/src/Cli/dotnet/Commands/Hidden/InternalReportInstallSuccess/InternalReportInstallSuccessCommand.cs b/src/Cli/dotnet/Commands/Hidden/InternalReportInstallSuccess/InternalReportInstallSuccessCommand.cs index f7465642ef34..744289023948 100644 --- a/src/Cli/dotnet/Commands/Hidden/InternalReportInstallSuccess/InternalReportInstallSuccessCommand.cs +++ b/src/Cli/dotnet/Commands/Hidden/InternalReportInstallSuccess/InternalReportInstallSuccessCommand.cs @@ -25,8 +25,7 @@ public static int Run(ParseResult parseResult) public static void ProcessInputAndSendTelemetry(string[] args, ITelemetry telemetry) { - var parser = Parser.Instance; - var result = parser.ParseFrom("dotnet internal-reportinstallsuccess", args); + var result = Parser.Parse(["dotnet", "internal-reportinstallsuccess", ..args]); ProcessInputAndSendTelemetry(result, telemetry); } diff --git a/src/Cli/dotnet/Commands/Hidden/Parse/ParseCommand.cs b/src/Cli/dotnet/Commands/Hidden/Parse/ParseCommand.cs index 79bf95ecdebd..262944805cdd 100644 --- a/src/Cli/dotnet/Commands/Hidden/Parse/ParseCommand.cs +++ b/src/Cli/dotnet/Commands/Hidden/Parse/ParseCommand.cs @@ -15,7 +15,7 @@ public static int Run(ParseResult result) result.HandleDebugSwitch(); var tokens = result.Tokens.Skip(1).Select(t => t.Value).ToArray(); - var reparsed = Parser.Instance.Parse(tokens); + var reparsed = Parser.Parse(tokens); Console.WriteLine(reparsed.ToString()); diff --git a/src/Cli/dotnet/Commands/MSBuild/MSBuildCommand.cs b/src/Cli/dotnet/Commands/MSBuild/MSBuildCommand.cs index b9c7a3153c44..cf0b7e06c660 100644 --- a/src/Cli/dotnet/Commands/MSBuild/MSBuildCommand.cs +++ b/src/Cli/dotnet/Commands/MSBuild/MSBuildCommand.cs @@ -14,8 +14,7 @@ public class MSBuildCommand( { public static MSBuildCommand FromArgs(string[] args, string? msbuildPath = null) { - var parser = Parser.Instance; - var result = parser.ParseFrom("dotnet msbuild", args); + var result = Parser.Parse(["dotnet", "msbuild", ..args]); return FromParseResult(result, msbuildPath); } diff --git a/src/Cli/dotnet/Commands/Pack/PackCommand.cs b/src/Cli/dotnet/Commands/Pack/PackCommand.cs index 8e1b4aa8b81d..1c3e41c13dd0 100644 --- a/src/Cli/dotnet/Commands/Pack/PackCommand.cs +++ b/src/Cli/dotnet/Commands/Pack/PackCommand.cs @@ -16,8 +16,7 @@ public class PackCommand( { public static PackCommand FromArgs(string[] args, string? msbuildPath = null) { - var parser = Parser.Instance; - var parseResult = parser.ParseFrom("dotnet pack", args); + var parseResult = Parser.Parse(["dotnet", "pack", ..args]); return FromParseResult(parseResult, msbuildPath); } diff --git a/src/Cli/dotnet/Commands/Package/Add/PackageAddCommand.cs b/src/Cli/dotnet/Commands/Package/Add/PackageAddCommand.cs index 080fa97a52e6..00eb0b72583a 100644 --- a/src/Cli/dotnet/Commands/Package/Add/PackageAddCommand.cs +++ b/src/Cli/dotnet/Commands/Package/Add/PackageAddCommand.cs @@ -34,7 +34,7 @@ public override int Execute() var tempDgFilePath = string.Empty; - if (_parseResult.GetResult(PackageAddCommandParser.NoRestoreOption) is null) + if (!_parseResult.GetValue(PackageAddCommandParser.NoRestoreOption)) { try @@ -121,7 +121,7 @@ private string[] TransformArgs(PackageIdentityWithRange packageId, string tempDg .OptionValuesToBeForwarded() .SelectMany(a => a.Split(' ', 2))); - if (_parseResult.GetResult(PackageAddCommandParser.NoRestoreOption) is not null) + if (_parseResult.GetValue(PackageAddCommandParser.NoRestoreOption)) { args.Add("--no-restore"); } diff --git a/src/Cli/dotnet/Commands/Publish/PublishCommand.cs b/src/Cli/dotnet/Commands/Publish/PublishCommand.cs index eab6dee108b3..08e23bfe9eca 100644 --- a/src/Cli/dotnet/Commands/Publish/PublishCommand.cs +++ b/src/Cli/dotnet/Commands/Publish/PublishCommand.cs @@ -21,8 +21,7 @@ private PublishCommand( public static CommandBase FromArgs(string[] args, string? msbuildPath = null) { - var parser = Parser.Instance; - var parseResult = parser.ParseFrom("dotnet publish", args); + var parseResult = Parser.Parse(["dotnet", "publish", ..args]); return FromParseResult(parseResult); } diff --git a/src/Cli/dotnet/Commands/Restore/RestoreCommand.cs b/src/Cli/dotnet/Commands/Restore/RestoreCommand.cs index ee8c6f32d5d4..6eb650b0e261 100644 --- a/src/Cli/dotnet/Commands/Restore/RestoreCommand.cs +++ b/src/Cli/dotnet/Commands/Restore/RestoreCommand.cs @@ -13,8 +13,7 @@ public static class RestoreCommand { public static CommandBase FromArgs(string[] args, string? msbuildPath = null) { - var parser = Parser.Instance; - var result = parser.ParseFrom("dotnet restore", args); + var result = Parser.Parse(["dotnet", "restore", ..args]); return FromParseResult(result, msbuildPath); } diff --git a/src/Cli/dotnet/Commands/Run/RunCommand.cs b/src/Cli/dotnet/Commands/Run/RunCommand.cs index 68e4c399774b..e01f2a862c67 100644 --- a/src/Cli/dotnet/Commands/Run/RunCommand.cs +++ b/src/Cli/dotnet/Commands/Run/RunCommand.cs @@ -516,7 +516,7 @@ private static void ThrowUnableToRunError(ProjectInstance project) public static RunCommand FromArgs(string[] args) { - var parseResult = Parser.Instance.ParseFrom("dotnet run", args); + var parseResult = Parser.Parse(["dotnet", "run", ..args]); return FromParseResult(parseResult); } @@ -654,7 +654,7 @@ public static ParseResult ModifyParseResultForShorthandProjectOption(ParseResult tokensMinusProject.Add(possibleProject); var tokensToParse = tokensMinusProject.ToArray(); - var newParseResult = Parser.Instance.Parse(tokensToParse); + var newParseResult = Parser.Parse(tokensToParse); return newParseResult; } } diff --git a/src/Cli/dotnet/Commands/Store/StoreCommand.cs b/src/Cli/dotnet/Commands/Store/StoreCommand.cs index 3842e23a0330..0c7846c513e2 100644 --- a/src/Cli/dotnet/Commands/Store/StoreCommand.cs +++ b/src/Cli/dotnet/Commands/Store/StoreCommand.cs @@ -19,8 +19,7 @@ private StoreCommand(IEnumerable msbuildArgs, string msbuildPath = null) public static StoreCommand FromArgs(string[] args, string msbuildPath = null) { - var parser = Parser.Instance; - var result = parser.ParseFrom("dotnet store", args); + var result = Parser.Parse(["dotnet", "store", ..args]); return FromParseResult(result, msbuildPath); } diff --git a/src/Cli/dotnet/Commands/Test/TestCommand.cs b/src/Cli/dotnet/Commands/Test/TestCommand.cs index 5d603c75181a..7e180d7ce63b 100644 --- a/src/Cli/dotnet/Commands/Test/TestCommand.cs +++ b/src/Cli/dotnet/Commands/Test/TestCommand.cs @@ -154,8 +154,7 @@ private static int ForwardToVSTestConsole(ParseResult parseResult, string[] args public static TestCommand FromArgs(string[] args, string? testSessionCorrelationId = null, string? msbuildPath = null) { - var parser = Parser.Instance; - var parseResult = parser.ParseFrom("dotnet test", args); + var parseResult = Parser.Parse(["dotnet", "test", ..args]); // settings parameters are after -- (including --), these should not be considered by the parser string[] settings = [.. args.SkipWhile(a => a != "--")]; @@ -218,7 +217,7 @@ private static TestCommand FromParseResult(ParseResult result, string[] settings msbuildArgs.Add($"-property:VSTestSessionCorrelationId={testSessionCorrelationId}"); } - bool noRestore = (result.GetResult(TestCommandParser.NoRestoreOption) ?? result.GetResult(TestCommandParser.NoBuildOption)) is not null; + bool noRestore = result.GetValue(TestCommandParser.NoRestoreOption) || result.GetValue(TestCommandParser.NoBuildOption); var parsedMSBuildArgs = MSBuildArgs.AnalyzeMSBuildArguments( msbuildArgs, diff --git a/src/Cli/dotnet/Commands/Test/TestCommandParser.cs b/src/Cli/dotnet/Commands/Test/TestCommandParser.cs index 9cf9b5e7bafe..cf9539c1439c 100644 --- a/src/Cli/dotnet/Commands/Test/TestCommandParser.cs +++ b/src/Cli/dotnet/Commands/Test/TestCommandParser.cs @@ -86,13 +86,13 @@ internal static class TestCommandParser { Description = CliCommandStrings.CmdBlameDescription, Arity = ArgumentArity.Zero - }.ForwardAs("-property:VSTestBlame=true"); + }.ForwardIfEnabled("-property:VSTestBlame=true"); public static readonly Option BlameCrashOption = new ForwardedOption("--blame-crash") { Description = CliCommandStrings.CmdBlameCrashDescription, Arity = ArgumentArity.Zero - }.ForwardAs("-property:VSTestBlameCrash=true"); + }.ForwardIfEnabled("-property:VSTestBlameCrash=true"); public static readonly Option BlameCrashDumpOption = CreateBlameCrashDumpOption(); @@ -112,7 +112,7 @@ private static Option CreateBlameCrashDumpOption() { Description = CliCommandStrings.CmdBlameCrashCollectAlwaysDescription, Arity = ArgumentArity.Zero - }.ForwardAsMany(o => ["-property:VSTestBlameCrash=true", "-property:VSTestBlameCrashCollectAlways=true"]); + }.ForwardIfEnabled(["-property:VSTestBlameCrash=true", "-property:VSTestBlameCrashCollectAlways=true"]); public static readonly Option BlameHangOption = new ForwardedOption("--blame-hang") { @@ -144,7 +144,7 @@ private static Option CreateBlameHangDumpOption() { Description = CliCommandStrings.TestCmdNoLogo, Arity = ArgumentArity.Zero - }.ForwardAs("-property:VSTestNoLogo=true"); + }.ForwardIfEnabled("-property:VSTestNoLogo=true"); public static readonly Option NoRestoreOption = CommonOptions.NoRestoreOption; diff --git a/src/Cli/dotnet/Commands/Tool/Common/ToolAppliedOption.cs b/src/Cli/dotnet/Commands/Tool/Common/ToolAppliedOption.cs index dfff85eee14b..8972da740eff 100644 --- a/src/Cli/dotnet/Commands/Tool/Common/ToolAppliedOption.cs +++ b/src/Cli/dotnet/Commands/Tool/Common/ToolAppliedOption.cs @@ -5,6 +5,7 @@ using System.CommandLine; using Microsoft.DotNet.Cli.Commands.Tool.Install; +using Microsoft.DotNet.Cli.Extensions; using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Cli.Commands.Tool.Common; @@ -56,17 +57,17 @@ internal static void EnsureNoConflictGlobalLocalToolPathOption( string message) { List options = []; - if (parseResult.GetResult(GlobalOptionName) is not null) + if (parseResult.HasOption(GlobalOptionName)) { options.Add(GlobalOptionName); } - if (parseResult.GetResult(LocalOptionName) is not null) + if (parseResult.HasOption(LocalOptionName)) { options.Add(LocalOptionName); } - if (parseResult.GetResult(ToolPathName) is not null) + if (parseResult.HasOption(ToolPathName)) { options.Add(ToolPathName); } @@ -85,12 +86,12 @@ internal static void EnsureNoConflictUpdateAllVersionOption( string message) { List options = []; - if (parseResult.GetResult(UpdateAllOption) is not null) + if (parseResult.HasOption(UpdateAllOption)) { options.Add(UpdateAllOption.Name); } - if (parseResult.GetResult(VersionOption) is not null) + if (parseResult.HasOption(VersionOption)) { options.Add(VersionOption.Name); } @@ -107,7 +108,7 @@ internal static void EnsureNoConflictUpdateAllVersionOption( internal static void EnsureToolManifestAndOnlyLocalFlagCombination(ParseResult parseResult) { if (GlobalOrToolPath(parseResult) && - parseResult.GetResult(ToolManifestName) is not null) + parseResult.HasOption(ToolManifestName)) { throw new GracefulException( string.Format( @@ -116,6 +117,6 @@ internal static void EnsureToolManifestAndOnlyLocalFlagCombination(ParseResult p } private static bool GlobalOrToolPath(ParseResult parseResult) - => parseResult.GetResult(GlobalOptionName) is not null - || parseResult.GetResult(ToolPathName) is not null; + => parseResult.HasOption(GlobalOptionName) + || parseResult.HasOption(ToolPathName); } diff --git a/src/Cli/dotnet/Commands/Tool/Update/ToolUpdateCommand.cs b/src/Cli/dotnet/Commands/Tool/Update/ToolUpdateCommand.cs index fa56775604ad..7eff66e84cb7 100644 --- a/src/Cli/dotnet/Commands/Tool/Update/ToolUpdateCommand.cs +++ b/src/Cli/dotnet/Commands/Tool/Update/ToolUpdateCommand.cs @@ -6,6 +6,7 @@ using System.CommandLine; using Microsoft.DotNet.Cli.Commands.Tool.Common; using Microsoft.DotNet.Cli.Commands.Tool.Install; +using Microsoft.DotNet.Cli.Extensions; using Microsoft.DotNet.Cli.ToolManifest; using Microsoft.DotNet.Cli.ToolPackage; using Microsoft.DotNet.Cli.Utils; @@ -64,7 +65,7 @@ internal static void EnsureEitherUpdateAllOrUpdateOption( string message) { List options = []; - if (parseResult.GetResult(ToolAppliedOption.UpdateAllOption) is not null) + if (parseResult.HasOption(ToolAppliedOption.UpdateAllOption)) { options.Add(ToolAppliedOption.UpdateAllOption.Name); } diff --git a/src/Cli/dotnet/Commands/Workload/WorkloadCommandParser.cs b/src/Cli/dotnet/Commands/Workload/WorkloadCommandParser.cs index 9188e4589aba..51603be141dd 100644 --- a/src/Cli/dotnet/Commands/Workload/WorkloadCommandParser.cs +++ b/src/Cli/dotnet/Commands/Workload/WorkloadCommandParser.cs @@ -159,7 +159,7 @@ private static Command ConstructCommand() command.Validators.Add(commandResult => { - if (commandResult.GetResult(InfoOption) is null && commandResult.GetResult(VersionOption) is null && !commandResult.Children.Any(child => child is System.CommandLine.Parsing.CommandResult)) + if (commandResult.HasOption(InfoOption) && commandResult.HasOption(VersionOption) && !commandResult.Children.Any(child => child is System.CommandLine.Parsing.CommandResult)) { commandResult.AddError(CliStrings.RequiredCommandNotPassed); } diff --git a/src/Cli/dotnet/CommonOptions.cs b/src/Cli/dotnet/CommonOptions.cs index 2ba66beb48c4..aff691d5f250 100644 --- a/src/Cli/dotnet/CommonOptions.cs +++ b/src/Cli/dotnet/CommonOptions.cs @@ -273,7 +273,7 @@ public static ForwardedOption InteractiveOption(bool acceptArgument = fals Description = CliStrings.DisableBuildServersOptionDescription, Arity = ArgumentArity.Zero } - .ForwardAsMany(_ => ["--property:UseRazorBuildServer=false", "--property:UseSharedCompilation=false", "/nodeReuse:false"]); + .ForwardIfEnabled(["--property:UseRazorBuildServer=false", "--property:UseSharedCompilation=false", "/nodeReuse:false"]); public static Option ArchitectureOption = new ForwardedOption("--arch", "-a") @@ -311,7 +311,7 @@ public static ForwardedOption InteractiveOption(bool acceptArgument = fals { Description = CliStrings.SelfContainedOptionDescription } - .SetForwardingFunction(ForwardSelfContainedOptions); + .ForwardIfEnabled([$"--property:SelfContained=true", "--property:_CommandLineDefinedSelfContained=true"]); public static Option NoSelfContainedOption = new ForwardedOption("--no-self-contained") @@ -319,7 +319,7 @@ public static ForwardedOption InteractiveOption(bool acceptArgument = fals Description = CliStrings.FrameworkDependentOptionDescription, Arity = ArgumentArity.Zero } - .SetForwardingFunction((_, p) => ForwardSelfContainedOptions(false, p)); + .ForwardIfEnabled([$"--property:SelfContained=false", "--property:_CommandLineDefinedSelfContained=true"]); public static readonly Option> EnvOption = new("--environment", "-e") { @@ -446,12 +446,6 @@ public static string GetCurrentRuntimeId() private static string GetArchFromRid(string rid) => rid.Substring(rid.LastIndexOf("-", StringComparison.InvariantCulture) + 1, rid.Length - rid.LastIndexOf("-", StringComparison.InvariantCulture) - 1); - private static IEnumerable ForwardSelfContainedOptions(bool isSelfContained, ParseResult parseResult) - { - IEnumerable selfContainedProperties = [$"--property:SelfContained={isSelfContained}", "--property:_CommandLineDefinedSelfContained=true"]; - return selfContainedProperties; - } - internal static Option AddCompletions(this Option option, Func> completionSource) { option.CompletionSources.Add(completionSource); diff --git a/src/Cli/dotnet/DotNetCommandFactory.cs b/src/Cli/dotnet/DotNetCommandFactory.cs index 54ea99bac5e1..ea5eb912e8f6 100644 --- a/src/Cli/dotnet/DotNetCommandFactory.cs +++ b/src/Cli/dotnet/DotNetCommandFactory.cs @@ -38,7 +38,7 @@ private static bool TryGetBuiltInCommand(string commandName, out Func action.InvokeAsync(Parser.Instance.Parse(args)).Result; + commandFunc = (args) => Parser.Invoke([commandName, ..args]); return true; } commandFunc = null; diff --git a/src/Cli/dotnet/Extensions/OptionForwardingExtensions.cs b/src/Cli/dotnet/Extensions/OptionForwardingExtensions.cs index b8078b6515c6..72d0424c65de 100644 --- a/src/Cli/dotnet/Extensions/OptionForwardingExtensions.cs +++ b/src/Cli/dotnet/Extensions/OptionForwardingExtensions.cs @@ -13,11 +13,36 @@ public static class OptionForwardingExtensions { public static ForwardedOption Forward(this ForwardedOption option) => option.SetForwardingFunction((T? o) => [option.Name]); + /// + /// Forward the boolean option as a string value. This value will be forwarded as long as the option has a OptionResult - which means that + /// any implicit value calculation will cause the string value to be forwarded. For boolean options specifically, if the option is zero arity + /// and has no default value factory, S.CL will synthesize a true or false value based on whether the option was provided or not, so we need to + /// add an additional implicit 'value is true' check to prevent accidentally forwarding the option for flags that are absent.. + /// + public static ForwardedOption ForwardAs(this ForwardedOption option, string value) => option.ForwardIfEnabled(value); + + /// + /// Forward the option as a string value. This value will be forwarded as long as the option has a OptionResult - which means that + /// any implicit value calculation will cause the string value to be forwarded. + /// public static ForwardedOption ForwardAs(this ForwardedOption option, string value) => option.SetForwardingFunction((T? o) => [value]); public static ForwardedOption ForwardAsSingle(this ForwardedOption option, Func format) => option.SetForwardingFunction(format); - public static ForwardedOption ForwardIfEnabled(this ForwardedOption option, string value) => option.SetForwardingFunction((bool o) => o == true ? [value] : []); + /// + /// Forward the boolean option as a string value. This value will be forwarded as long as the option has a OptionResult - which means that + /// any implicit value calculation will cause the string value to be forwarded. For boolean options specifically, if the option is zero arity + /// and has no default value factory, S.CL will synthesize a true or false value based on whether the option was provided or not, so we need to + /// add an additional implicit 'value is true' check to prevent accidentally forwarding the option for flags that are absent.. + /// + public static ForwardedOption ForwardIfEnabled(this ForwardedOption option, string value) => option.SetForwardingFunction((bool o) => o ? [value] : []); + /// + /// Forward the boolean option as a string value. This value will be forwarded as long as the option has a OptionResult - which means that + /// any implicit value calculation will cause the string value to be forwarded. For boolean options specifically, if the option is zero arity + /// and has no default value factory, S.CL will synthesize a true or false value based on whether the option was provided or not, so we need to + /// add an additional implicit 'value is true' check to prevent accidentally forwarding the option for flags that are absent.. + /// + public static ForwardedOption ForwardIfEnabled(this ForwardedOption option, string[] value) => option.SetForwardingFunction((bool o) => o ? value : []); /// /// Set up an option to be forwarded as an output path to MSBuild diff --git a/src/Cli/dotnet/Extensions/ParseResultExtensions.cs b/src/Cli/dotnet/Extensions/ParseResultExtensions.cs index 781140230adb..17d74908d42e 100644 --- a/src/Cli/dotnet/Extensions/ParseResultExtensions.cs +++ b/src/Cli/dotnet/Extensions/ParseResultExtensions.cs @@ -5,10 +5,10 @@ using System.CommandLine.Parsing; using System.Diagnostics; using System.Text.RegularExpressions; +using Microsoft.DotNet.Cli; using Microsoft.DotNet.Cli.Commands.Run; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Cli.Utils.Extensions; -using static Microsoft.DotNet.Cli.Parser; using CommandResult = System.CommandLine.Parsing.CommandResult; namespace Microsoft.DotNet.Cli.Extensions; @@ -30,9 +30,10 @@ public static void ShowHelp(this ParseResult parseResult) { // take from the start of the list until we hit an option/--/unparsed token // since commands can have arguments, we must take those as well in order to get accurate help - var tokenList = parseResult.Tokens.TakeWhile(token => token.Type == TokenType.Argument || token.Type == TokenType.Command || token.Type == TokenType.Directive).Select(t => t.Value).ToList(); - tokenList.Add("-h"); - Instance.Parse(tokenList).Invoke(); + Parser.Parse([ + ..parseResult.Tokens.TakeWhile(token => token.Type == TokenType.Argument || token.Type == TokenType.Command || token.Type == TokenType.Directive).Select(t => t.Value), + "-h" + ]).Invoke(); } public static void ShowHelpOrErrorIfAppropriate(this ParseResult parseResult) @@ -92,7 +93,7 @@ public static string RootSubCommandResult(this ParseResult parseResult) public static bool IsDotnetBuiltInCommand(this ParseResult parseResult) { return string.IsNullOrEmpty(parseResult.RootSubCommandResult()) || - GetBuiltInCommand(parseResult.RootSubCommandResult()) != null; + Parser.GetBuiltInCommand(parseResult.RootSubCommandResult()) != null; } public static bool IsTopLevelDotnetCommand(this ParseResult parseResult) @@ -102,9 +103,9 @@ public static bool IsTopLevelDotnetCommand(this ParseResult parseResult) public static bool CanBeInvoked(this ParseResult parseResult) { - return GetBuiltInCommand(parseResult.RootSubCommandResult()) != null || + return Parser.GetBuiltInCommand(parseResult.RootSubCommandResult()) != null || parseResult.Tokens.Any(token => token.Type == TokenType.Directive) || - (parseResult.IsTopLevelDotnetCommand() && string.IsNullOrEmpty(parseResult.GetValue(DotnetSubCommand))); + (parseResult.IsTopLevelDotnetCommand() && string.IsNullOrEmpty(parseResult.GetValue(Parser.DotnetSubCommand))); } public static int HandleMissingCommand(this ParseResult parseResult) @@ -134,7 +135,7 @@ public static string[] GetSubArguments(this string[] args) return [ .. subargs - .SkipWhile(arg => DiagOption.Name.Equals(arg) || DiagOption.Aliases.Contains(arg) || arg.Equals("dotnet")) + .SkipWhile(arg => Parser.DiagOption.Name.Equals(arg) || Parser.DiagOption.Aliases.Contains(arg) || arg.Equals("dotnet")) .Skip(1), // remove top level command (ex build or publish) .. runArgs ]; @@ -153,7 +154,7 @@ public static bool DiagOptionPrecedesSubcommand(this string[] args, string subCo { return false; } - else if (DiagOption.Name.Equals(args) || DiagOption.Aliases.Contains(args[i])) + else if (Parser.DiagOption.Name.Equals(args) || Parser.DiagOption.Aliases.Contains(args[i])) { return true; } @@ -166,7 +167,7 @@ public static bool DiagOptionPrecedesSubcommand(this string[] args, string subCo { CommandResult commandResult => commandResult.Command.Name, ArgumentResult argResult => argResult.Tokens.FirstOrDefault()?.Value, - _ => parseResult.GetResult(DotnetSubCommand)?.GetValueOrDefault() + _ => parseResult.GetResult(Parser.DotnetSubCommand)?.GetValueOrDefault() }; public static bool BothArchAndOsOptionsSpecified(this ParseResult parseResult) => @@ -293,4 +294,17 @@ public static void HandleDebugSwitch(this ParseResult parseResult) /// public static bool HasOption(this ParseResult parseResult, string name) => parseResult.GetResult(name) is OptionResult or && !or.Implicit; + + /// + /// Checks if the option is present and not implicit (i.e. not set by default). + /// This is useful for checking if the user has explicitly set an option, as opposed to it being set by default. + /// + public static bool HasOption(this SymbolResult symbolResult, Option option) => symbolResult.GetResult(option) is OptionResult or && !or.Implicit; + + /// + /// Checks if the option with given name is present and not implicit (i.e. not set by default). + /// This is useful for checking if the user has explicitly set an option, as opposed to it being set by default. + /// + public static bool HasOption(this SymbolResult symbolResult, string name) + => symbolResult.GetResult(name) is OptionResult or && !or.Implicit; } diff --git a/src/Cli/dotnet/Extensions/ParserExtensions.cs b/src/Cli/dotnet/Extensions/ParserExtensions.cs deleted file mode 100644 index a51f7d4fd999..000000000000 --- a/src/Cli/dotnet/Extensions/ParserExtensions.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System.CommandLine; - -namespace Microsoft.DotNet.Cli.Extensions; - -public static class ParserExtensions -{ - public static ParseResult ParseFrom( - this CommandLineConfiguration parser, - string context, - string[] args = null) => - parser.Parse([.. context.Split(' '), .. args]); -} diff --git a/src/Cli/dotnet/Parser.cs b/src/Cli/dotnet/Parser.cs index 260c7dd3b82c..8e79913ea085 100644 --- a/src/Cli/dotnet/Parser.cs +++ b/src/Cli/dotnet/Parser.cs @@ -53,11 +53,6 @@ namespace Microsoft.DotNet.Cli; public static class Parser { - public static readonly RootCommand RootCommand = new() - { - Directives = { new DiagramDirective(), new SuggestDirective(), new EnvironmentVariablesDirective() } - }; - public static readonly Command InstallSuccessCommand = InternalReportInstallSuccessCommandParser.GetCommand(); // Subcommands @@ -131,7 +126,7 @@ public static class Parser // Argument public static readonly Argument DotnetSubCommand = new("subcommand") { Arity = ArgumentArity.ZeroOrOne, Hidden = true }; - private static Command ConfigureCommandLine(RootCommand rootCommand) + private static RootCommand ConfigureCommandLine(RootCommand rootCommand) { for (int i = rootCommand.Options.Count - 1; i >= 0; i--) { @@ -183,7 +178,7 @@ private static Command ConfigureCommandLine(RootCommand rootCommand) else { // when user does not specify any args (just "dotnet"), a usage needs to be printed - parseResult.Configuration.Output.WriteLine(CliUsage.HelpText); + parseResult.InvocationConfiguration.Output.WriteLine(CliUsage.HelpText); return 0; } }); @@ -224,13 +219,44 @@ public static bool TokenPerLine(string tokenToReplace, out IReadOnlyList } } - public static CommandLineConfiguration Instance { get; } = new(ConfigureCommandLine(RootCommand)) + public static ParserConfiguration ParserConfiguration { get; } = new() { - EnableDefaultExceptionHandler = false, EnablePosixBundling = false, ResponseFileTokenReplacer = TokenPerLine }; + public static InvocationConfiguration InvocationConfiguration { get; } = new() + { + EnableDefaultExceptionHandler = false, + }; + + /// + /// The root command for the .NET CLI. + /// + /// + /// If you use this Command directly, you _must_ use + /// and to ensure that the command line parser + /// and invoker are configured correctly. + /// + public static RootCommand RootCommand { get; } = ConfigureCommandLine(new() + { + Directives = { new DiagramDirective(), new SuggestDirective(), new EnvironmentVariablesDirective() } + }); + + /// + /// You probably want to use instead of this method. + /// This has to internally split the string into an array of arguments + /// before parsing, which is not as efficient as using the array overload. + /// And also won't always split tokens the way the user will expect on their shell. + /// + public static ParseResult Parse(string commandLineUnsplit) => RootCommand.Parse(commandLineUnsplit, ParserConfiguration); + public static ParseResult Parse(string[] args) => RootCommand.Parse(args, ParserConfiguration); + public static int Invoke(ParseResult parseResult) => parseResult.Invoke(InvocationConfiguration); + public static Task InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken = default) => parseResult.InvokeAsync(InvocationConfiguration, cancellationToken); + public static int Invoke(string[] args) => Invoke(Parse(args)); + public static Task InvokeAsync(string[] args, CancellationToken cancellationToken = default) => InvokeAsync(Parse(args), cancellationToken); + + internal static int ExceptionHandler(Exception exception, ParseResult parseResult) { if (exception is TargetInvocationException) @@ -407,7 +433,7 @@ internal PrintCliSchemaAction() } public override int Invoke(ParseResult parseResult) { - CliSchema.PrintCliSchema(parseResult.CommandResult, parseResult.Configuration.Output, Program.TelemetryClient); + CliSchema.PrintCliSchema(parseResult.CommandResult, parseResult.InvocationConfiguration.Output, Program.TelemetryClient); return 0; } } diff --git a/src/Cli/dotnet/Program.cs b/src/Cli/dotnet/Program.cs index fa3fc09973f0..e7932f44c25b 100644 --- a/src/Cli/dotnet/Program.cs +++ b/src/Cli/dotnet/Program.cs @@ -129,7 +129,7 @@ internal static int ProcessArgs(string[] args, TimeSpan startupTime) ParseResult parseResult; using (new PerformanceMeasurement(performanceData, "Parse Time")) { - parseResult = Parser.Instance.Parse(args); + parseResult = Parser.Parse(args); // Avoid create temp directory with root permission and later prevent access in non sudo // This method need to be run very early before temp folder get created @@ -298,7 +298,7 @@ internal static int ProcessArgs(string[] args, TimeSpan startupTime) otherTokens.Add(token.Value); } } - parseResult = Parser.Instance.Parse(["run", unmatchedCommandOrFile, .. otherTokens]); + parseResult = Parser.Parse(["run", unmatchedCommandOrFile, .. otherTokens]); InvokeBuiltInCommand(parseResult, out var exitCode); return exitCode; @@ -315,7 +315,7 @@ static void InvokeBuiltInCommand(ParseResult parseResult, out int exitCode) try { - exitCode = parseResult.Invoke(); + exitCode = Parser.Invoke(parseResult); exitCode = AdjustExitCode(parseResult, exitCode); } catch (Exception exception) diff --git a/src/System.CommandLine.StaticCompletions/CompletionsCommand.cs b/src/System.CommandLine.StaticCompletions/CompletionsCommand.cs index 3b1520693dd9..d6ee05b6d353 100644 --- a/src/System.CommandLine.StaticCompletions/CompletionsCommand.cs +++ b/src/System.CommandLine.StaticCompletions/CompletionsCommand.cs @@ -114,7 +114,7 @@ public GenerateScriptCommand(Argument shellArg) { IShellProvider shell = args.GetValue(shellArg)!; // this cannot be null due to the way the shellArg is defined/configured var script = shell.GenerateCompletions(args.RootCommandResult.Command); - args.Configuration.Output.Write(script); + args.InvocationConfiguration.Output.Write(script); }); } } diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets index 324d7a1ba638..3ad44991d7a6 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets @@ -53,7 +53,10 @@ Copyright (c) .NET Foundation. All rights reserved. + Condition="'$(RestoreEnablePackagePruning)' == 'true' + AND '$(TargetFrameworkIdentifier)' == '.NETCoreApp' + AND '$(TargetFrameworkVersion)' != '' + AND $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '8.0'))"> $(NetCoreRoot)\sdk\$(NETCoreSdkVersion)\PrunePackageData\ diff --git a/test/ArgumentForwarding.Tests/ArgumentForwardingTests.cs b/test/ArgumentForwarding.Tests/ArgumentForwardingTests.cs index 9f7250d5984f..ab4d043740ed 100644 --- a/test/ArgumentForwarding.Tests/ArgumentForwardingTests.cs +++ b/test/ArgumentForwarding.Tests/ArgumentForwardingTests.cs @@ -151,8 +151,7 @@ public void TestArgumentForwardingCmdFailsWithUnbalancedQuote(string testArgStri public void ForwardAsWorks() { var cmd = Microsoft.DotNet.Cli.Commands.Package.Add.PackageAddCommandParser.GetCommand(); - var parser = new System.CommandLine.CommandLineConfiguration(cmd); - var parseResult = parser.Parse(["package", "add", "thing", "--prerelease"]); + var parseResult = cmd.Parse(["package", "add", "thing", "--prerelease"]); var forwardedValues = parseResult.OptionValuesToBeForwarded(); forwardedValues.Should().Contain("--prerelease"); } diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithoutTransitiveProjectRefs.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithoutTransitiveProjectRefs.cs index 591444054cf4..acc7cb050244 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithoutTransitiveProjectRefs.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithoutTransitiveProjectRefs.cs @@ -28,14 +28,15 @@ public void It_builds_the_project_successfully_with_static_graph_and_isolation() [Fact] public void It_cleans_the_project_successfully_with_static_graph_and_isolation() { - var (testAsset, outputDirectories) = BuildAppWithTransitiveDependenciesAndTransitiveCompileReference(new[] { "/graph" }); + var (testAsset, outputDirectories) = BuildAppWithTransitiveDependenciesAndTransitiveCompileReference(new[] { "/graph", "/bl:build-{}.binlog" }); var cleanCommand = new DotnetCommand( Log, "msbuild", Path.Combine(testAsset.TestRoot, "1", "1.csproj"), "/t:clean", - "/graph"); + "/graph", + "/bl:clean-{}.binlog"); cleanCommand .Execute() diff --git a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToResolveConflicts.cs b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToResolveConflicts.cs index 4d926061e571..f201aaf8feda 100644 --- a/test/Microsoft.NET.Build.Tests/GivenThatWeWantToResolveConflicts.cs +++ b/test/Microsoft.NET.Build.Tests/GivenThatWeWantToResolveConflicts.cs @@ -282,6 +282,7 @@ public void PlatformPackagesCanBePruned(bool prunePackages) IsExe = false }; referencedProject.PackageReferences.Add(new TestPackageReference("System.Text.Json", "8.0.0")); + referencedProject.AdditionalProperties["RestoreEnablePackagePruning"] = prunePackages.ToString(); var testProject = new TestProject() { @@ -315,21 +316,21 @@ public void PlatformPackagesCanBePruned(bool prunePackages) [InlineData(ToolsetInfo.CurrentTargetFramework)] [InlineData("net9.0")] [InlineData("net8.0")] - [InlineData("net7.0")] - [InlineData("net6.0")] - [InlineData("netcoreapp3.1")] - [InlineData("netcoreapp3.0")] - [InlineData("netcoreapp2.1")] - [InlineData("netcoreapp2.0")] + // [InlineData("net7.0", false)] TODO: https://github.com/NuGet/Home/issues/14424 + // [InlineData("net6.0", false)] TODO: https://github.com/NuGet/Home/issues/14424 + // [InlineData("netcoreapp3.1")] TODO: https://github.com/NuGet/Home/issues/14424 + // [InlineData("netcoreapp3.0")] TODO: https://github.com/NuGet/Home/issues/14424 + [InlineData("netcoreapp2.1", false)] + [InlineData("netcoreapp2.0", false)] [InlineData("netcoreapp1.1", false)] [InlineData("netcoreapp1.0", false)] - [InlineData("netstandard2.1")] - [InlineData("netstandard2.0")] + [InlineData("netstandard2.1", false)] + [InlineData("netstandard2.0", false)] [InlineData("netstandard1.1", false)] [InlineData("netstandard1.0", false)] [InlineData("net451", false)] - [InlineData("net462")] - [InlineData("net481")] + [InlineData("net462", false)] + [InlineData("net481", false)] public void PrunePackageDataSucceeds(string targetFramework, bool shouldPrune = true) { var nugetFramework = NuGetFramework.Parse(targetFramework); diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs index d4c4671169b8..8e5a4e24a227 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs @@ -966,14 +966,20 @@ public void ILLink_verify_analysis_warnings_framework_assemblies(string targetFr "ILLink : Trim analysis warning IL2026: System.ComponentModel.DefaultValueAttribute.DefaultValueAttribute(Type, String): Using member" }); } - // windows-only COM warnings - if (Net10Plus.Any(tfm => (string)tfm[0] == targetFramework) && RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + if (Net10Plus.Any(tfm => (string)tfm[0] == targetFramework)) { expectedWarnings.AddRange(new string[] { - "ILLink : Trim analysis warning IL2045: Internal.Runtime.InteropServices.ComActivator.BasicClassFactory.CreateValidatedInterfaceType(Type, Guid&, Object): Attribute 'System.Runtime.InteropServices.ClassInterfaceAttribute' is being referenced in code but the trimmer was instructed to remove all instances of this attribute. If the attribute instances are necessary make sure to either remove the trimmer attribute XML portion which removes the attribute instances, or override the removal by using the trimmer XML descriptor to keep the attribute type (which in turn keeps all of its instances).", - "ILLink : Trim analysis warning IL2045: Internal.Runtime.InteropServices.ComActivator.BasicClassFactory.CreateValidatedInterfaceType(Type, Guid&, Object): Attribute 'System.Runtime.InteropServices.ClassInterfaceAttribute' is being referenced in code but the trimmer was instructed to remove all instances of this attribute. If the attribute instances are necessary make sure to either remove the trimmer attribute XML portion which removes the attribute instances, or override the removal by using the trimmer XML descriptor to keep the attribute type (which in turn keeps all of its instances).", - "ILLink : Trim analysis warning IL2045: Internal.Runtime.InteropServices.ComActivator.BasicClassFactory.CreateValidatedInterfaceType(Type, Guid&, Object): Attribute 'System.Runtime.InteropServices.ClassInterfaceAttribute' is being referenced in code but the trimmer was instructed to remove all instances of this attribute. If the attribute instances are necessary make sure to either remove the trimmer attribute XML portion which removes the attribute instances, or override the removal by using the trimmer XML descriptor to keep the attribute type (which in turn keeps all of its instances)." + "ILLink : Trim analysis warning IL2067: System.ComponentModel.DefaultValueAttribute.DefaultValueAttribute(Type, String): 'typeToConvert' argument does not satisfy 'DynamicallyAccessedMemberTypes.All' in call to 'System.ComponentModel.DefaultValueAttribute" }); + // windows-only COM warnings + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + expectedWarnings.AddRange(new string[] { + "ILLink : Trim analysis warning IL2045: Internal.Runtime.InteropServices.ComActivator.BasicClassFactory.CreateValidatedInterfaceType(Type, Guid&, Object): Attribute 'System.Runtime.InteropServices.ClassInterfaceAttribute' is being referenced in code but the trimmer was instructed to remove all instances of this attribute. If the attribute instances are necessary make sure to either remove the trimmer attribute XML portion which removes the attribute instances, or override the removal by using the trimmer XML descriptor to keep the attribute type (which in turn keeps all of its instances).", + "ILLink : Trim analysis warning IL2045: Internal.Runtime.InteropServices.ComActivator.BasicClassFactory.CreateValidatedInterfaceType(Type, Guid&, Object): Attribute 'System.Runtime.InteropServices.ClassInterfaceAttribute' is being referenced in code but the trimmer was instructed to remove all instances of this attribute. If the attribute instances are necessary make sure to either remove the trimmer attribute XML portion which removes the attribute instances, or override the removal by using the trimmer XML descriptor to keep the attribute type (which in turn keeps all of its instances).", + "ILLink : Trim analysis warning IL2045: Internal.Runtime.InteropServices.ComActivator.BasicClassFactory.CreateValidatedInterfaceType(Type, Guid&, Object): Attribute 'System.Runtime.InteropServices.ClassInterfaceAttribute' is being referenced in code but the trimmer was instructed to remove all instances of this attribute. If the attribute instances are necessary make sure to either remove the trimmer attribute XML portion which removes the attribute instances, or override the removal by using the trimmer XML descriptor to keep the attribute type (which in turn keeps all of its instances)." + }); + } } var testProject = CreateTestProjectForILLinkTesting(_testAssetsManager, targetFramework, projectName); diff --git a/test/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs b/test/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs index 47fc2a014d90..83367ee3df6c 100644 --- a/test/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs +++ b/test/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs @@ -3,6 +3,8 @@ using System.Globalization; using FluentAssertions.Primitives; +using DiffPlex.Renderer; +using System.Diagnostics.CodeAnalysis; namespace Microsoft.NET.TestFramework.Assertions { @@ -13,14 +15,46 @@ private static string NormalizeLineEndings(string s) return s.Replace("\r\n", "\n"); } - public static AndConstraint BeVisuallyEquivalentTo(this StringAssertions assertions, string expected, string because = "", params object[] becauseArgs) + /// + /// Checks that two strings look to same to humans - if not a git-style diff will be reported. + /// + /// Supply a non-default reason for the failure. By default, a git-style diff is reported. If you override this, the diff string will be added to the + /// so you can use it in your template string. + public static AndConstraint BeVisuallyEquivalentTo( + this StringAssertions assertions, + string expected, +#if NET + [StringSyntax(nameof(CompositeFormat))] +#endif + string because = "", + params object[] becauseArgs) { - string.Compare(NormalizeLineEndings(assertions.Subject), NormalizeLineEndings(expected), CultureInfo.CurrentCulture, CompareOptions.IgnoreSymbols) - .Should().Be(0, $"String \"{assertions.Subject}\" is not visually equivalent to expected string \"{expected}\"."); + var normalizedActual = NormalizeLineEndings(assertions.Subject); + var normalizedExpected = NormalizeLineEndings(expected); + var areSame = string.Compare(normalizedActual, normalizedExpected, CultureInfo.CurrentCulture, CompareOptions.IgnoreSymbols) == 0; + if (!areSame) + { + var diff = UnidiffRenderer.GenerateUnidiff(oldText: normalizedExpected, newText: normalizedActual, oldFileName: "expected", newFileName: "actual", ignoreWhitespace: true); + areSame.Should().Be(true, because: string.IsNullOrEmpty(because) ? $"The input strings are not visually equivalent. Diff is:\n" + diff : because, becauseArgs: [.. becauseArgs, diff]); + } + return new AndConstraint(assertions); } - public static AndConstraint BeVisuallyEquivalentToIfNotLocalized(this StringAssertions assertions, string expected, string because = "", params object[] becauseArgs) + /// + /// Checks that two strings look to same to humans - if not a git-style diff will be reported. + /// + /// Supply a non-default reason for the failure. By default, a git-style diff is reported. If you override this, the diff string will be added to the + /// so you can use it in your template string. + public static AndConstraint BeVisuallyEquivalentToIfNotLocalized( + this StringAssertions assertions, + string expected, +#if NET + [StringSyntax(nameof(CompositeFormat))] +#endif + string because = "", + params object[] becauseArgs + ) { if (!TestContext.IsLocalized()) { diff --git a/test/Microsoft.NET.TestFramework/Microsoft.NET.TestFramework.csproj b/test/Microsoft.NET.TestFramework/Microsoft.NET.TestFramework.csproj index fef4cf243d82..7829d0829246 100644 --- a/test/Microsoft.NET.TestFramework/Microsoft.NET.TestFramework.csproj +++ b/test/Microsoft.NET.TestFramework/Microsoft.NET.TestFramework.csproj @@ -45,12 +45,13 @@ Some tests (e.g. dotnet-watch.Tests) need to have total control over the loading of MSBuild assemblies. --> + - - - + + + diff --git a/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/Approvals/HelpTests.CanShowCommandOptions_Basic.verified.txt b/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/Approvals/HelpTests.CanShowCommandOptions_Basic.verified.txt index c1cf414ee89a..c31a69227973 100644 --- a/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/Approvals/HelpTests.CanShowCommandOptions_Basic.verified.txt +++ b/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/Approvals/HelpTests.CanShowCommandOptions_Basic.verified.txt @@ -1,8 +1,8 @@ Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. diff --git a/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/Approvals/HelpTests.CanShowCommandOptions_Language.verified.txt b/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/Approvals/HelpTests.CanShowCommandOptions_Language.verified.txt index 88ae5cfe0297..8df806615e30 100644 --- a/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/Approvals/HelpTests.CanShowCommandOptions_Language.verified.txt +++ b/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/Approvals/HelpTests.CanShowCommandOptions_Language.verified.txt @@ -1,9 +1,9 @@ Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. -lang, --language Specifies the template language to instantiate. diff --git a/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/Approvals/HelpTests.CanShowCommandOptions_Type.verified.txt b/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/Approvals/HelpTests.CanShowCommandOptions_Type.verified.txt index bfc647ebcda6..68d712b4aea5 100644 --- a/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/Approvals/HelpTests.CanShowCommandOptions_Type.verified.txt +++ b/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/Approvals/HelpTests.CanShowCommandOptions_Type.verified.txt @@ -1,9 +1,9 @@ Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. --type Specifies the template type to instantiate. diff --git a/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/InstantiateTests.Subcommand.cs b/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/InstantiateTests.Subcommand.cs index d7dbba8f2678..a830cf96d278 100644 --- a/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/InstantiateTests.Subcommand.cs +++ b/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/InstantiateTests.Subcommand.cs @@ -83,8 +83,8 @@ internal void Create_CanParseNameOption(string command, string? expectedValue) var instantiateCommand = (InstantiateCommand)parseResult.CommandResult.Command; var args = new InstantiateCommandArgs(instantiateCommand, parseResult); TemplateCommand templateCommand = new(instantiateCommand, settings, packageManager, templateGroup, templateGroup.Templates.Single()); - CommandLineConfiguration parser = ParserFactory.CreateParser(templateCommand); - ParseResult templateParseResult = parser.Parse(args.TokensToInvoke ?? Array.Empty()); + Command parser = ParserFactory.CreateParser(templateCommand); + ParseResult templateParseResult = parser.Parse(args.TokensToInvoke ?? Array.Empty(), ParserFactory.ParserConfiguration); var templateArgs = new TemplateCommandArgs(templateCommand, instantiateCommand, templateParseResult); Assert.Equal(expectedValue, templateArgs.Name); @@ -146,8 +146,8 @@ internal void Create_CanParseTemplateOptions(string command, string parameterNam var instantiateCommand = (InstantiateCommand)parseResult.CommandResult.Command; var args = new InstantiateCommandArgs(instantiateCommand, parseResult); TemplateCommand templateCommand = new(instantiateCommand, settings, packageManager, templateGroup, templateGroup.Templates.Single()); - CommandLineConfiguration parser = ParserFactory.CreateParser(templateCommand); - ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty()); + Command parser = ParserFactory.CreateParser(templateCommand); + ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty(), ParserFactory.ParserConfiguration); var templateArgs = new TemplateCommandArgs(templateCommand, instantiateCommand, templateParseResult); if (string.IsNullOrWhiteSpace(expectedValue)) @@ -181,8 +181,8 @@ internal void Create_CanParseChoiceTemplateOptions(string command, string parame var instantiateCommand = (InstantiateCommand)parseResult.CommandResult.Command; var args = new InstantiateCommandArgs(instantiateCommand, parseResult); TemplateCommand templateCommand = new(instantiateCommand, settings, packageManager, templateGroup, templateGroup.Templates.Single()); - CommandLineConfiguration parser = ParserFactory.CreateParser(templateCommand); - ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty()); + Command parser = ParserFactory.CreateParser(templateCommand); + ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty(), ParserFactory.ParserConfiguration); var templateArgs = new TemplateCommandArgs(templateCommand, instantiateCommand, templateParseResult); if (string.IsNullOrWhiteSpace(expectedValue)) @@ -224,8 +224,8 @@ internal void Create_CanDetectParseErrorsTemplateOptions( var args = new InstantiateCommandArgs(instantiateCommand, parseResult); TemplateCommand templateCommand = new(instantiateCommand, settings, packageManager, templateGroup, templateGroup.Templates.Single()); - CommandLineConfiguration parser = ParserFactory.CreateParser(templateCommand); - ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty()); + Command parser = ParserFactory.CreateParser(templateCommand); + ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty(), ParserFactory.ParserConfiguration); Assert.True(templateParseResult.Errors.Any()); Assert.Equal(expectedError, templateParseResult.Errors.Single().Message); } @@ -258,8 +258,8 @@ internal void Create_CanDetectParseErrorsChoiceTemplateOptions( var args = new InstantiateCommandArgs(instantiateCommand, parseResult); TemplateCommand templateCommand = new(instantiateCommand, settings, packageManager, templateGroup, templateGroup.Templates.Single()); - CommandLineConfiguration parser = ParserFactory.CreateParser(templateCommand); - ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty()); + Command parser = ParserFactory.CreateParser(templateCommand); + ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty(), ParserFactory.ParserConfiguration); Assert.True(templateParseResult.Errors.Any()); Assert.Equal(expectedError, templateParseResult.Errors.Single().Message); } diff --git a/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/InstantiateTests.cs b/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/InstantiateTests.cs index d3a0b2beeaa7..be602117b2fe 100644 --- a/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/InstantiateTests.cs +++ b/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/InstantiateTests.cs @@ -255,8 +255,8 @@ internal void CanParseNameOption(string command, string? expectedValue) ParseResult parseResult = rootCommand.Parse(command); InstantiateCommandArgs args = InstantiateCommandArgs.FromNewCommandArgs(new NewCommandArgs(myCommand, parseResult)); TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.Templates.Single()); - CommandLineConfiguration parser = ParserFactory.CreateParser(templateCommand); - ParseResult templateParseResult = parser.Parse(args.TokensToInvoke ?? Array.Empty()); + Command parser = ParserFactory.CreateParser(templateCommand); + ParseResult templateParseResult = parser.Parse(args.TokensToInvoke ?? Array.Empty(), ParserFactory.ParserConfiguration); var templateArgs = new TemplateCommandArgs(templateCommand, myCommand, templateParseResult); Assert.Equal(expectedValue, templateArgs.Name); @@ -317,12 +317,12 @@ internal void CanParseTemplateOptions(string command, string parameterName, stri TemplatePackageManager packageManager = A.Fake(); NewCommand myCommand = (NewCommand)NewCommandFactory.Create("new", _ => host); - CommandLineConfiguration parser = ParserFactory.CreateParser(myCommand); - ParseResult parseResult = parser.Parse($" new {command}"); + Command parser = ParserFactory.CreateParser(myCommand); + ParseResult parseResult = parser.Parse($" new {command}", ParserFactory.ParserConfiguration); InstantiateCommandArgs args = InstantiateCommandArgs.FromNewCommandArgs(new NewCommandArgs(myCommand, parseResult)); TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.Templates.Single()); - CommandLineConfiguration templateCommandParser = ParserFactory.CreateParser(templateCommand); - ParseResult templateParseResult = templateCommandParser.Parse(args.RemainingArguments ?? Array.Empty()); + Command templateCommandParser = ParserFactory.CreateParser(templateCommand); + ParseResult templateParseResult = templateCommandParser.Parse(args.RemainingArguments ?? Array.Empty(), ParserFactory.ParserConfiguration); var templateArgs = new TemplateCommandArgs(templateCommand, myCommand, templateParseResult); if (string.IsNullOrWhiteSpace(expectedValue)) @@ -364,8 +364,8 @@ internal void CanParseChoiceTemplateOptions(string command, string parameterName ParseResult parseResult = myCommand.Parse($" new {command}"); InstantiateCommandArgs args = InstantiateCommandArgs.FromNewCommandArgs(new NewCommandArgs(myCommand, parseResult)); TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.Templates.Single()); - CommandLineConfiguration parser = ParserFactory.CreateParser(templateCommand); - ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty()); + Command parser = ParserFactory.CreateParser(templateCommand); + ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty(), ParserFactory.ParserConfiguration); var templateArgs = new TemplateCommandArgs(templateCommand, myCommand, templateParseResult); if (string.IsNullOrWhiteSpace(expectedValue)) @@ -408,8 +408,8 @@ internal void CanParseMultiChoiceTemplateOptions(string command, string paramete ParseResult parseResult = myCommand.Parse($" new {command}"); InstantiateCommandArgs args = InstantiateCommandArgs.FromNewCommandArgs(new NewCommandArgs(myCommand, parseResult)); TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.Templates.Single()); - CommandLineConfiguration parser = ParserFactory.CreateParser(templateCommand); - ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty()); + Command parser = ParserFactory.CreateParser(templateCommand); + ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty(), ParserFactory.ParserConfiguration); var templateArgs = new TemplateCommandArgs(templateCommand, myCommand, templateParseResult); if (string.IsNullOrWhiteSpace(expectedValue)) @@ -479,7 +479,7 @@ internal void CanDetectParseErrorsTemplateOptions( InstantiateCommandArgs args = InstantiateCommandArgs.FromNewCommandArgs(new NewCommandArgs(myCommand, parseResult)); TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.Templates.Single()); - CommandLineConfiguration parser = ParserFactory.CreateParser(templateCommand); + Command parser = ParserFactory.CreateParser(templateCommand); ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty()); Assert.True(templateParseResult.Errors.Any()); Assert.Equal(expectedError, templateParseResult.Errors.Single().Message); @@ -519,13 +519,13 @@ internal void CanDetectParseErrorsChoiceTemplateOptions( TemplatePackageManager packageManager = A.Fake(); NewCommand myCommand = (NewCommand)NewCommandFactory.Create("new", _ => host); - CommandLineConfiguration parser = ParserFactory.CreateParser(myCommand); + Command parser = ParserFactory.CreateParser(myCommand); ParseResult parseResult = parser.Parse($" new {command}"); InstantiateCommandArgs args = InstantiateCommandArgs.FromNewCommandArgs(new NewCommandArgs(myCommand, parseResult)); TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.Templates.Single()); - CommandLineConfiguration templateCommandParser = ParserFactory.CreateParser(templateCommand); - ParseResult templateParseResult = templateCommandParser.Parse(args.RemainingArguments ?? Array.Empty()); + Command templateCommandParser = ParserFactory.CreateParser(templateCommand); + ParseResult templateParseResult = templateCommandParser.Parse(args.RemainingArguments ?? Array.Empty(), ParserFactory.ParserConfiguration); Assert.True(templateParseResult.Errors.Any()); Assert.Equal(expectedError, templateParseResult.Errors.Single().Message); } @@ -548,7 +548,7 @@ internal void DoNotAddAllowScriptOptionForTemplate() InstantiateCommandArgs args = InstantiateCommandArgs.FromNewCommandArgs(new NewCommandArgs(myCommand, parseResult)); TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.Templates.Single()); - CommandLineConfiguration parser = ParserFactory.CreateParser(templateCommand); + Command parser = ParserFactory.CreateParser(templateCommand); ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty()); TemplateCommandArgs templateArgs = new(templateCommand, myCommand, templateParseResult); @@ -581,7 +581,7 @@ internal void CanParseAllowScriptsOption(string command, AllowRunScripts? result InstantiateCommandArgs args = InstantiateCommandArgs.FromNewCommandArgs(new NewCommandArgs(myCommand, parseResult)); TemplateCommand templateCommand = new(myCommand, settings, packageManager, templateGroup, templateGroup.Templates.Single()); - CommandLineConfiguration parser = ParserFactory.CreateParser(templateCommand); + Command parser = ParserFactory.CreateParser(templateCommand); ParseResult templateParseResult = parser.Parse(args.RemainingArguments ?? Array.Empty()); TemplateCommandArgs templateArgs = new(templateCommand, myCommand, templateParseResult); @@ -745,7 +745,7 @@ internal void CanParseFlagsOption(string command, string action) templatePackageManager: packageManager, templateGroup: templateGroup, template: templateGroup.Templates.Single()); - CommandLineConfiguration parser = ParserFactory.CreateParser(templateCommand); + Command parser = ParserFactory.CreateParser(templateCommand); ParseResult templateParseResult = parser.Parse(args.TokensToInvoke ?? Array.Empty()); var templateArgs = new TemplateCommandArgs(templateCommand, myCommand, templateParseResult); diff --git a/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/MiscTests.cs b/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/MiscTests.cs index 10ad62d08119..6d422bdf94e4 100644 --- a/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/MiscTests.cs +++ b/test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/MiscTests.cs @@ -18,8 +18,7 @@ public class MiscTests : BaseTest [Fact] public void KnownHelpAliasesAreCorrect() { - ParseResult result = new CommandLineConfiguration(new RootCommand()) - .Parse(Constants.KnownHelpAliases[0]); + var result = new RootCommand().Parse(Constants.KnownHelpAliases[0]); Option helpOption = result.CommandResult .Children diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowAllowScriptsOption.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowAllowScriptsOption.verified.txt index 19a83af88ce8..429fc71c1afb 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowAllowScriptsOption.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowAllowScriptsOption.verified.txt @@ -7,9 +7,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. --allow-scripts Specifies if post action scripts should run. [default: Prompt] diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplateWhenRequiredParamIsMissed.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplateWhenRequiredParamIsMissed.verified.txt index e6075ba71b86..2ba8f39281f8 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplateWhenRequiredParamIsMissed.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplateWhenRequiredParamIsMissed.verified.txt @@ -7,9 +7,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. -lang, --language Specifies the template language to instantiate. --type Specifies the template type to instantiate. diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplateWhenRequiredParamIsMissedAndConditionIntroduced.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplateWhenRequiredParamIsMissedAndConditionIntroduced.verified.txt index 933017ac9ce2..65276ae5aeec 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplateWhenRequiredParamIsMissedAndConditionIntroduced.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplateWhenRequiredParamIsMissedAndConditionIntroduced.verified.txt @@ -7,9 +7,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. -lang, --language Specifies the template language to instantiate. --type Specifies the template type to instantiate. diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_ConditionalParams.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_ConditionalParams.verified.txt index e9ff6f8f86e6..102415c83452 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_ConditionalParams.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_ConditionalParams.verified.txt @@ -7,9 +7,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. Template options: @@ -23,4 +23,4 @@ Template options: -A, --A_enabled Type: bool Default: False -B, --B_enabled Type: bool - Default: False + Default: False \ No newline at end of file diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MatchOnChoice.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MatchOnChoice.verified.txt index d67771cd20e8..c37aa07f2827 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MatchOnChoice.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MatchOnChoice.verified.txt @@ -8,9 +8,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. -lang, --language Specifies the template language to instantiate. --type Specifies the template type to instantiate. diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MatchOnLanguage.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MatchOnLanguage.verified.txt index 88dddbd16725..87260c7bdb85 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MatchOnLanguage.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MatchOnLanguage.verified.txt @@ -8,9 +8,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. -lang, --language Specifies the template language to instantiate. --type Specifies the template type to instantiate. diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MatchOnNonChoiceParam.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MatchOnNonChoiceParam.verified.txt index 1abc77fddd46..ab5fdcab62f6 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MatchOnNonChoiceParam.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MatchOnNonChoiceParam.verified.txt @@ -8,9 +8,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. -lang, --language Specifies the template language to instantiate. --type Specifies the template type to instantiate. diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MultipleValueChoice.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MultipleValueChoice.verified.txt index 2346c0bc2c1e..1051212445d5 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MultipleValueChoice.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_MultipleValueChoice.verified.txt @@ -7,9 +7,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. Template options: diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_RequiredParams.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_RequiredParams.verified.txt index 702659c846ea..889bdbdba34f 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_RequiredParams.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_RequiredParams.verified.txt @@ -7,9 +7,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. Template options: diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_classlib.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_classlib.verified.txt index 0f0749f71b7d..570cf789de59 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_classlib.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_classlib.verified.txt @@ -8,9 +8,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. -lang, --language Specifies the template language to instantiate. --type Specifies the template type to instantiate. diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_console.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_console.verified.txt index 1abc77fddd46..ab5fdcab62f6 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_console.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_console.verified.txt @@ -8,9 +8,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. -lang, --language Specifies the template language to instantiate. --type Specifies the template type to instantiate. diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_globaljson.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_globaljson.verified.txt index 5ace42c10f19..a23bbb9092c3 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_globaljson.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelpForTemplate_globaljson.verified.txt @@ -9,9 +9,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. --type Specifies the template type to instantiate. diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Create_common.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Create_common.verified.txt index dc768995fb5b..67159edeb0e6 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Create_common.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Create_common.verified.txt @@ -11,10 +11,10 @@ Arguments: Options: -o, --output Location to place the generated output. -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. -v, --verbosity Sets the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], and diag[nostic]. [default: normal] - -d, --diagnostics Enables diagnostic output. + -d, --diagnostics Enables diagnostic output. [default: False] -?, -h, --help Show command line help. \ No newline at end of file diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Install_common.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Install_common.verified.txt index 9ab3d82267e9..f70496fcdd49 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Install_common.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Install_common.verified.txt @@ -9,9 +9,9 @@ Arguments: To install the NuGet package of certain version, use ::. Options: - --interactive Allows the command to stop and wait for user input or action (for example to complete authentication). + --interactive Allows the command to stop and wait for user input or action (for example to complete authentication). [default: False] --add-source, --nuget-source Specifies a NuGet source to use. - --force Allows installing template packages from the specified sources even if they would override a template package from another source. + --force Allows installing template packages from the specified sources even if they would override a template package from another source. [default: False] -v, --verbosity Sets the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], and diag[nostic]. [default: normal] - -d, --diagnostics Enables diagnostic output. + -d, --diagnostics Enables diagnostic output. [default: False] -?, -h, --help Show command line help. \ No newline at end of file diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_List_common.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_List_common.verified.txt index 8873025e6950..7013467c5eca 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_List_common.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_List_common.verified.txt @@ -12,11 +12,11 @@ Options: -lang, --language Filters templates based on language. --type Filters templates based on available types. Predefined values are "project" and "item". --tag Filters the templates based on the tag. - --ignore-constraints Disables checking if the template meets the constraints to be run. + --ignore-constraints Disables checking if the template meets the constraints to be run. [default: False] -o, --output Location to place the generated output. --project The project that should be used for context evaluation. - --columns-all Displays all columns in the output. + --columns-all Displays all columns in the output. [default: False] --columns Specifies the columns to display in the output. -v, --verbosity Sets the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], and diag[nostic]. [default: normal] - -d, --diagnostics Enables diagnostic output. + -d, --diagnostics Enables diagnostic output. [default: False] -?, -h, --help Show command line help. \ No newline at end of file diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Search_common.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Search_common.verified.txt index 7ed392216ebf..4d65ad13ee5b 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Search_common.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Search_common.verified.txt @@ -13,8 +13,8 @@ Options: --type Filters templates based on available types. Predefined values are "project" and "item". --tag Filters the templates based on the tag. --package Filters the templates based on NuGet package ID. - --columns-all Displays all columns in the output. + --columns-all Displays all columns in the output. [default: False] --columns Specifies the columns to display in the output. -v, --verbosity Sets the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], and diag[nostic]. [default: normal] - -d, --diagnostics Enables diagnostic output. + -d, --diagnostics Enables diagnostic output. [default: False] -?, -h, --help Show command line help. \ No newline at end of file diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Uninstall_common.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Uninstall_common.verified.txt index 1055bb5368f2..bd1a487836c2 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Uninstall_common.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Uninstall_common.verified.txt @@ -10,5 +10,5 @@ Arguments: Options: -v, --verbosity Sets the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], and diag[nostic]. [default: normal] - -d, --diagnostics Enables diagnostic output. + -d, --diagnostics Enables diagnostic output. [default: False] -?, -h, --help Show command line help. \ No newline at end of file diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Update_common.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Update_common.verified.txt index 575e5d2123b5..673565e357f7 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Update_common.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_Update_common.verified.txt @@ -5,9 +5,9 @@ Usage: dotnet new update [options] Options: - --interactive Allows the command to stop and wait for user input or action (for example to complete authentication). + --interactive Allows the command to stop and wait for user input or action (for example to complete authentication). [default: False] --add-source, --nuget-source Specifies a NuGet source to use. - --check-only, --dry-run Only checks for updates and display the template packages to be updated without applying update. + --check-only, --dry-run Only checks for updates and display the template packages to be updated without applying update. [default: False] -v, --verbosity Sets the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], and diag[nostic]. [default: normal] - -d, --diagnostics Enables diagnostic output. + -d, --diagnostics Enables diagnostic output. [default: False] -?, -h, --help Show command line help. \ No newline at end of file diff --git a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_common.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_common.verified.txt index 3baccbf04096..8988b1bf82d4 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_common.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/DotnetNewHelpTests.CanShowHelp_common.verified.txt @@ -12,12 +12,12 @@ Arguments: Options: -o, --output Location to place the generated output. -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. -v, --verbosity Sets the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], and diag[nostic]. [default: normal] - -d, --diagnostics Enables diagnostic output. + -d, --diagnostics Enables diagnostic output. [default: False] -?, -h, --help Show command line help. Commands: diff --git a/test/dotnet-new.IntegrationTests/Approvals/WebProjectsTests.CanShowHelp_Mvc.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/WebProjectsTests.CanShowHelp_Mvc.verified.txt index 484502dcd3bd..c178d93fd019 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/WebProjectsTests.CanShowHelp_Mvc.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/WebProjectsTests.CanShowHelp_Mvc.verified.txt @@ -9,9 +9,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. -lang, --language Specifies the template language to instantiate. --type Specifies the template type to instantiate. diff --git a/test/dotnet-new.IntegrationTests/Approvals/WebProjectsTests.CanShowHelp_WebAPI.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/WebProjectsTests.CanShowHelp_WebAPI.verified.txt index 15840d90da36..505e0515bdd2 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/WebProjectsTests.CanShowHelp_WebAPI.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/WebProjectsTests.CanShowHelp_WebAPI.verified.txt @@ -8,9 +8,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. -lang, --language Specifies the template language to instantiate. --type Specifies the template type to instantiate. diff --git a/test/dotnet-new.IntegrationTests/Approvals/WebProjectsTests.CanShowHelp_Webapp_common.verified.txt b/test/dotnet-new.IntegrationTests/Approvals/WebProjectsTests.CanShowHelp_Webapp_common.verified.txt index aebfecade450..ffe74d0e22a5 100644 --- a/test/dotnet-new.IntegrationTests/Approvals/WebProjectsTests.CanShowHelp_Webapp_common.verified.txt +++ b/test/dotnet-new.IntegrationTests/Approvals/WebProjectsTests.CanShowHelp_Webapp_common.verified.txt @@ -10,9 +10,9 @@ Usage: Options: -n, --name The name for the output being created. If no name is specified, the name of the output directory is used. -o, --output Location to place the generated output. - --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. - --force Forces content to be generated even if it would change existing files. - --no-update-check Disables checking for the template package updates when instantiating a template. + --dry-run Displays a summary of what would happen if the given command line were run if it would result in a template creation. [default: False] + --force Forces content to be generated even if it would change existing files. [default: False] + --no-update-check Disables checking for the template package updates when instantiating a template. [default: False] --project The project that should be used for context evaluation. -lang, --language Specifies the template language to instantiate. --type Specifies the template type to instantiate. diff --git a/test/dotnet-watch.Tests/CommandLine/CommandLineOptionsTests.cs b/test/dotnet-watch.Tests/CommandLine/CommandLineOptionsTests.cs index a879537f5c47..75c341657328 100644 --- a/test/dotnet-watch.Tests/CommandLine/CommandLineOptionsTests.cs +++ b/test/dotnet-watch.Tests/CommandLine/CommandLineOptionsTests.cs @@ -423,9 +423,9 @@ public void ShortFormForLaunchProfileArgumentWorks() [InlineData(new[] { "--property", "b=1" }, new[] { "--property:b=1", NugetInteractiveProperty })] [InlineData(new[] { "--interactive" }, new[] { "--property:NuGetInteractive=true" })] [InlineData(new[] { "--no-restore" }, new[] { NugetInteractiveProperty, "-restore:false" })] - [InlineData(new[] { "--sc" }, new[] { NugetInteractiveProperty, "--property:SelfContained=True", "--property:_CommandLineDefinedSelfContained=true" })] - [InlineData(new[] { "--self-contained" }, new[] { NugetInteractiveProperty, "--property:SelfContained=True", "--property:_CommandLineDefinedSelfContained=true" })] - [InlineData(new[] { "--no-self-contained" }, new[] { NugetInteractiveProperty, "--property:SelfContained=False", "--property:_CommandLineDefinedSelfContained=true" })] + [InlineData(new[] { "--sc" }, new[] { NugetInteractiveProperty, "--property:SelfContained=true", "--property:_CommandLineDefinedSelfContained=true" })] + [InlineData(new[] { "--self-contained" }, new[] { NugetInteractiveProperty, "--property:SelfContained=true", "--property:_CommandLineDefinedSelfContained=true" })] + [InlineData(new[] { "--no-self-contained" }, new[] { NugetInteractiveProperty, "--property:SelfContained=false", "--property:_CommandLineDefinedSelfContained=true" })] [InlineData(new[] { "--verbosity", "q" }, new[] { NugetInteractiveProperty, "--verbosity:q" })] [InlineData(new[] { "--arch", "arm", "--os", "win" }, new[] { NugetInteractiveProperty, "--property:RuntimeIdentifier=win-arm" })] [InlineData(new[] { "--disable-build-servers" }, new[] { NugetInteractiveProperty, "--property:UseRazorBuildServer=false", "--property:UseSharedCompilation=false", "/nodeReuse:false" })] diff --git a/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs b/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs index 95c258b65945..91232edab696 100644 --- a/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs +++ b/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs @@ -136,7 +136,7 @@ public static void Print() } """); - App.Start(testAsset, [], "AppWithDeps"); + App.Start(testAsset, ["--non-interactive"], "AppWithDeps"); await App.AssertWaitingForChanges(); await App.WaitUntilOutputContains($"{symbolName} set"); @@ -144,14 +144,11 @@ public static void Print() UpdateSourceFile(buildFilePath, src => src.Replace(symbolName, "")); - // TODO: https://github.com/dotnet/roslyn/issues/78921 - - // Roslyn should detect change in build constant and apply it or flag it as rude edit. - //await App.WaitUntilOutputContains($"dotnet watch 🔥 [App.WithDeps ({ToolsetInfo.CurrentTargetFramework})] Hot reload succeeded."); - //await App.WaitUntilOutputContains("BUILD_CONST not set"); - - await App.AssertOutputLineStartsWith(MessageDescriptor.NoCSharpChangesToApply); + await App.AssertOutputLineStartsWith(MessageDescriptor.WaitingForChanges, failure: _ => false); App.AssertOutputContains(MessageDescriptor.ProjectChangeTriggeredReEvaluation); + App.AssertOutputContains("dotnet watch ⌚ [auto-restart] error ENC1102: Changing project setting 'DefineConstants'"); + + await App.WaitUntilOutputContains($"{symbolName} not set"); } [Fact(Skip = "https://github.com/dotnet/msbuild/issues/12001")] diff --git a/test/dotnet.Tests/CliSchemaTests.cs b/test/dotnet.Tests/CliSchemaTests.cs index 3ee43066bfe2..4fe64bcf0edc 100644 --- a/test/dotnet.Tests/CliSchemaTests.cs +++ b/test/dotnet.Tests/CliSchemaTests.cs @@ -23,7 +23,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Display solution folder paths.", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -87,7 +88,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Force the command to ignore any persistent build servers.", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -128,7 +130,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Do not display the startup banner or the copyright message.", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -216,7 +219,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "--automatic": { "hidden": true, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 1 @@ -241,7 +245,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Determines changes without actually modifying the file system", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -402,7 +407,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Prevent restoring multiple projects in parallel.", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -452,7 +458,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Treat package source failures as warnings.", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -464,7 +471,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Allow prerelease workload manifests.", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 1 @@ -489,7 +497,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Do not cache packages and http requests.", "hidden": true, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -501,7 +510,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Do not cache packages and http requests.", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -513,7 +523,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Only print the list of links to download without downloading.", "hidden": true, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 1 @@ -538,7 +549,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Skip updating the workload manifests.", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -550,7 +562,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Skip signature verification of workload packages and installers.", "hidden": true, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -697,7 +710,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "--debug": { "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -709,7 +723,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Force the command to ignore any persistent build servers.", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -721,7 +736,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "", "hidden": true, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -733,7 +749,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Force all dependencies to be resolved even if the last restore was successful.\nThis is equivalent to deleting project.assets.json.", "hidden": true, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -761,7 +778,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "", "hidden": true, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -786,7 +804,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "", "hidden": true, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -798,7 +817,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Do not build project-to-project references and only build the specified project.", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -810,7 +830,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "", "hidden": true, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -822,7 +843,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Do not use incremental building.", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -834,7 +856,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Do not restore the project before building.", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -846,7 +869,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Publish your application as a framework dependent application. A compatible .NET runtime must be installed on the target machine to run your application.", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -858,7 +882,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "description": "Do not display the startup banner or the copyright message.", "hidden": false, "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -965,7 +990,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "--sc" ], "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 1 @@ -1011,7 +1037,8 @@ public CliSchemaTests(ITestOutputHelper log) : base(log) "--ucr" ], "valueType": "System.Boolean", - "hasDefaultValue": false, + "hasDefaultValue": true, + "defaultValue": false, "arity": { "minimum": 0, "maximum": 0 @@ -1071,11 +1098,11 @@ public void PrintCliSchema_WritesExpectedJson(string[] commandArgs, string json) { var stream = new MemoryStream(); var writer = new StreamWriter(stream); - CliSchema.PrintCliSchema(Parser.Instance.Parse(commandArgs).CommandResult, writer, null); + CliSchema.PrintCliSchema(Parser.Parse(commandArgs).CommandResult, writer, null); stream.Position = 0; var reader = new StreamReader(stream); var output = reader.ReadToEnd(); - output.Should().BeEquivalentTo(json.ReplaceLineEndings("\n")); + output.Should().BeVisuallyEquivalentTo(json); } [Fact] diff --git a/test/dotnet.Tests/CommandTests/Build/BuildRelatedCommandParserTests.cs b/test/dotnet.Tests/CommandTests/Build/BuildRelatedCommandParserTests.cs index a761aa66bfeb..7af301cd98c8 100644 --- a/test/dotnet.Tests/CommandTests/Build/BuildRelatedCommandParserTests.cs +++ b/test/dotnet.Tests/CommandTests/Build/BuildRelatedCommandParserTests.cs @@ -44,7 +44,7 @@ public static TheoryData BuildRelatedCommandsAndOptions() [Theory] public void Build(string command, string option) { - var cliCommand = Parser.Instance.RootCommand.Children.OfType().FirstOrDefault(c => c.Name == command); + var cliCommand = Parser.RootCommand.Children.OfType().FirstOrDefault(c => c.Name == command); if (cliCommand is null) { throw new ArgumentException($"Command {command} not found in the dotnet CLI"); diff --git a/test/dotnet.Tests/CommandTests/Build/GivenDotnetBuildBuildsCsproj.cs b/test/dotnet.Tests/CommandTests/Build/GivenDotnetBuildBuildsCsproj.cs index 9cb6e8f4b700..2660810b616b 100644 --- a/test/dotnet.Tests/CommandTests/Build/GivenDotnetBuildBuildsCsproj.cs +++ b/test/dotnet.Tests/CommandTests/Build/GivenDotnetBuildBuildsCsproj.cs @@ -400,19 +400,13 @@ static string RelativeNuGetPath(string absoluteNuGetPath) [InlineData("run")] public void It_uses_correct_runtime_help_description(string command) { - CommandLineConfiguration sharedConfig = Parser.Instance; - CommandLineConfiguration localCopy = new(sharedConfig.RootCommand) + var output = new StringWriter(); + var parseResult = Parser.Parse(new string[] { command, "-h" }); + parseResult.Invoke(new() { - EnableDefaultExceptionHandler = sharedConfig.EnableDefaultExceptionHandler, - ResponseFileTokenReplacer = sharedConfig.ResponseFileTokenReplacer, - ProcessTerminationTimeout = sharedConfig.ProcessTerminationTimeout, - EnablePosixBundling = sharedConfig.EnablePosixBundling, - Output = new StringWriter() - }; - - var parseResult = localCopy.Parse(new string[] { command, "-h" }); - parseResult.Invoke(); - localCopy.Output.ToString().Should().Contain(command.Equals("build") ? + Output = output, + }); + output.ToString().Should().Contain(command.Equals("build") ? CliCommandStrings.BuildRuntimeOptionDescription : CliCommandStrings.RunRuntimeOptionDescription); } diff --git a/test/dotnet.Tests/CommandTests/BuildServer/Shutdown/BuildServerShutdownCommandTests.cs b/test/dotnet.Tests/CommandTests/BuildServer/Shutdown/BuildServerShutdownCommandTests.cs index fa8a372728a2..f8b0e85c1a0c 100644 --- a/test/dotnet.Tests/CommandTests/BuildServer/Shutdown/BuildServerShutdownCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/BuildServer/Shutdown/BuildServerShutdownCommandTests.cs @@ -51,7 +51,7 @@ public void GivenMSBuildOptionOnlyItEnumeratesOnlyMSBuildServers() .Setup(p => p.EnumerateBuildServers(ServerEnumerationFlags.MSBuild)) .Returns(Array.Empty()); - var command = CreateCommand(options: "--msbuild", serverProvider: provider.Object); + var command = CreateCommand(options: ["--msbuild"], serverProvider: provider.Object); command.Execute().Should().Be(0); @@ -69,7 +69,7 @@ public void GivenVBCSCompilerOptionOnlyItEnumeratesOnlyVBCSCompilers() .Setup(p => p.EnumerateBuildServers(ServerEnumerationFlags.VBCSCompiler)) .Returns(Array.Empty()); - var command = CreateCommand(options: "--vbcscompiler", serverProvider: provider.Object); + var command = CreateCommand(options: ["--vbcscompiler"], serverProvider: provider.Object); command.Execute().Should().Be(0); @@ -87,7 +87,7 @@ public void GivenRazorOptionOnlyItEnumeratesOnlyRazorServers() .Setup(p => p.EnumerateBuildServers(ServerEnumerationFlags.Razor)) .Returns(Array.Empty()); - var command = CreateCommand(options: "--razor", serverProvider: provider.Object); + var command = CreateCommand(options: ["--razor"], serverProvider: provider.Object); command.Execute().Should().Be(0); @@ -195,12 +195,12 @@ public void GivenARunningRazorServerItShutsDownSuccessfully() } private BuildServerShutdownCommand CreateCommand( - string options = "", + ReadOnlySpan options = default, IBuildServerProvider serverProvider = null, IEnumerable buildServers = null, ServerEnumerationFlags expectedFlags = ServerEnumerationFlags.None) { - ParseResult result = Parser.Instance.Parse($"dotnet build-server shutdown {options}".Trim()); + ParseResult result = Parser.Parse(["dotnet", "build-server", "shutdown", .. options]); return new BuildServerShutdownCommand( result: result, serverProvider: serverProvider, diff --git a/test/dotnet.Tests/CommandTests/BuildServer/Shutdown/BuildServerShutdownParserTests.cs b/test/dotnet.Tests/CommandTests/BuildServer/Shutdown/BuildServerShutdownParserTests.cs index 30917e607eb9..1f14f6072979 100644 --- a/test/dotnet.Tests/CommandTests/BuildServer/Shutdown/BuildServerShutdownParserTests.cs +++ b/test/dotnet.Tests/CommandTests/BuildServer/Shutdown/BuildServerShutdownParserTests.cs @@ -18,7 +18,7 @@ public BuildServerShutdownParserTests(ITestOutputHelper output) [Fact] public void GivenNoOptionsAllFlagsAreFalse() { - var result = Parser.Instance.Parse("dotnet build-server shutdown"); + var result = Parser.Parse(["dotnet", "build-server", "shutdown"]); result.GetValue(BuildServerShutdownCommandParser.MSBuildOption).Should().Be(false); result.GetValue(BuildServerShutdownCommandParser.VbcsOption).Should().Be(false); @@ -28,7 +28,7 @@ public void GivenNoOptionsAllFlagsAreFalse() [Fact] public void GivenMSBuildOptionIsItTrue() { - var result = Parser.Instance.Parse("dotnet build-server shutdown --msbuild"); + var result = Parser.Parse(["dotnet", "build-server", "shutdown", "--msbuild"]); result.GetValue(BuildServerShutdownCommandParser.MSBuildOption).Should().Be(true); result.GetValue(BuildServerShutdownCommandParser.VbcsOption).Should().Be(false); @@ -38,7 +38,7 @@ public void GivenMSBuildOptionIsItTrue() [Fact] public void GivenVBCSCompilerOptionIsItTrue() { - var result = Parser.Instance.Parse("dotnet build-server shutdown --vbcscompiler"); + var result = Parser.Parse(["dotnet", "build-server", "shutdown", "--vbcscompiler"]); result.GetValue(BuildServerShutdownCommandParser.MSBuildOption).Should().Be(false); result.GetValue(BuildServerShutdownCommandParser.VbcsOption).Should().Be(true); @@ -48,7 +48,7 @@ public void GivenVBCSCompilerOptionIsItTrue() [Fact] public void GivenRazorOptionIsItTrue() { - var result = Parser.Instance.Parse("dotnet build-server shutdown --razor"); + var result = Parser.Parse(["dotnet", "build-server", "shutdown", "--razor"]); result.GetValue(BuildServerShutdownCommandParser.MSBuildOption).Should().Be(false); result.GetValue(BuildServerShutdownCommandParser.VbcsOption).Should().Be(false); @@ -58,7 +58,7 @@ public void GivenRazorOptionIsItTrue() [Fact] public void GivenMultipleOptionsThoseAreTrue() { - var result = Parser.Instance.Parse("dotnet build-server shutdown --razor --msbuild"); + var result = Parser.Parse(["dotnet", "build-server", "shutdown", "--razor", "--msbuild"]); result.GetValue(BuildServerShutdownCommandParser.MSBuildOption).Should().Be(true); result.GetValue(BuildServerShutdownCommandParser.VbcsOption).Should().Be(false); diff --git a/test/dotnet.Tests/CommandTests/MSBuild/GivenDotnetOsArchOptions.cs b/test/dotnet.Tests/CommandTests/MSBuild/GivenDotnetOsArchOptions.cs index f9b849150db4..4b98db3a7b58 100644 --- a/test/dotnet.Tests/CommandTests/MSBuild/GivenDotnetOsArchOptions.cs +++ b/test/dotnet.Tests/CommandTests/MSBuild/GivenDotnetOsArchOptions.cs @@ -77,7 +77,7 @@ public void OptionsRespectUserSpecifiedSelfContained() string[] expectedArgs = [ .. ExpectedPrefix, .. DefaultArgs, - "--property:SelfContained=True", + "--property:SelfContained=true", "--property:_CommandLineDefinedSelfContained=true", "--property:RuntimeIdentifier=os-arch", .. GivenDotnetBuildInvocation.RestoreExpectedPrefixForImplicitRestore diff --git a/test/dotnet.Tests/CommandTests/New/WorkloadsInfoProviderTests.cs b/test/dotnet.Tests/CommandTests/New/WorkloadsInfoProviderTests.cs index 7e00f9fefa44..ff92878f3116 100644 --- a/test/dotnet.Tests/CommandTests/New/WorkloadsInfoProviderTests.cs +++ b/test/dotnet.Tests/CommandTests/New/WorkloadsInfoProviderTests.cs @@ -34,7 +34,7 @@ public async Task InstalledWorkloads_ShouldReturnExpectedWorkloads() .Returns((IEnumerable workloadIds) => workloadIds.Select(w => new WorkloadResolver.WorkloadInfo(w, $"Description: {w.ToString()}"))); - var parseResult = Parser.Instance.Parse(new string[] { "dotnet" }); + var parseResult = Parser.Parse(["dotnet"]); IWorkloadsRepositoryEnumerator workloadsEnumerator = new WorkloadInfoHelper( isInteractive: false, currentSdkVersion: "1.2.3", diff --git a/test/dotnet.Tests/CommandTests/NuGet/NuGetCommandParserTests.cs b/test/dotnet.Tests/CommandTests/NuGet/NuGetCommandParserTests.cs index 885b61f64784..b0da85c67c85 100644 --- a/test/dotnet.Tests/CommandTests/NuGet/NuGetCommandParserTests.cs +++ b/test/dotnet.Tests/CommandTests/NuGet/NuGetCommandParserTests.cs @@ -16,7 +16,7 @@ public class NuGetCommandParserTests [InlineData("--framework net472 -f net6.0")] public void NuGetWhyCommandCanParseFrameworkOptions(string inputOptions) { - var result = Parser.Instance.Parse($"dotnet nuget why C:\\path Fake.Package {inputOptions}"); + var result = Parser.Parse($"dotnet nuget why C:\\path Fake.Package {inputOptions}"); result.Errors.Should().BeEmpty(); var parsedArguments = result.GetArguments(); diff --git a/test/dotnet.Tests/CommandTests/Package/List/GivenDotnetListPackage.cs b/test/dotnet.Tests/CommandTests/Package/List/GivenDotnetListPackage.cs index b38dfe968001..e0901d0a4b68 100644 --- a/test/dotnet.Tests/CommandTests/Package/List/GivenDotnetListPackage.cs +++ b/test/dotnet.Tests/CommandTests/Package/List/GivenDotnetListPackage.cs @@ -347,7 +347,7 @@ public void ItListsFSharpProject() [InlineData(true, "--deprecated", "--outdated")] public void ItEnforcesOptionRules(bool throws, params string[] options) { - var parseResult = Parser.Instance.Parse($"dotnet list package {string.Join(' ', options)}"); + var parseResult = Parser.Parse(["dotnet", "list", "package", ..options]); Action checkRules = () => Microsoft.DotNet.Cli.Commands.Package.List.PackageListCommand.EnforceOptionRules(parseResult); if (throws) diff --git a/test/dotnet.Tests/CommandTests/Package/List/ListPackageParserTests.cs b/test/dotnet.Tests/CommandTests/Package/List/ListPackageParserTests.cs index 9f1a076584d2..01aed95e9eb9 100644 --- a/test/dotnet.Tests/CommandTests/Package/List/ListPackageParserTests.cs +++ b/test/dotnet.Tests/CommandTests/Package/List/ListPackageParserTests.cs @@ -12,7 +12,7 @@ public class ListPackageParserTests [Fact] public void ListPackageCanForwardInteractiveFlag() { - var result = Parser.Instance.Parse("dotnet list package --interactive"); + var result = Parser.Parse(["dotnet", "list", "package", "--interactive"]); result.OptionValuesToBeForwarded(ListPackageCommandParser.GetCommand()).Should().ContainSingle("--interactive"); result.Errors.Should().BeEmpty(); @@ -25,7 +25,7 @@ public void ListPackageCanForwardInteractiveFlag() [InlineData("-v", "")] public void ListPackageRejectsInvalidVerbosityFlags(string inputOption, string value) { - var result = Parser.Instance.Parse($"dotnet list package {inputOption} {value}"); + var result = Parser.Parse(["dotnet", "list", "package", inputOption, value]); result.Errors.Should().NotBeEmpty(); } @@ -46,7 +46,7 @@ public void ListPackageRejectsInvalidVerbosityFlags(string inputOption, string v [InlineData("-v", "QUIET")] public void ListPackageCanForwardVerbosityFlag(string inputOption, string value) { - var result = Parser.Instance.Parse($"dotnet list package {inputOption} {value}"); + var result = Parser.Parse(["dotnet", "list", "package", inputOption, value]); result .OptionValuesToBeForwarded(ListPackageCommandParser.GetCommand()) @@ -58,7 +58,7 @@ public void ListPackageCanForwardVerbosityFlag(string inputOption, string value) [Fact] public void ListPackageDoesNotForwardVerbosityByDefault() { - var result = Parser.Instance.Parse($"dotnet list package"); + var result = Parser.Parse(["dotnet", "list", "package"]); result .OptionValuesToBeForwarded(ListPackageCommandParser.GetCommand()) diff --git a/test/dotnet.Tests/CommandTests/Reference/Add/AddReferenceParserTests.cs b/test/dotnet.Tests/CommandTests/Reference/Add/AddReferenceParserTests.cs index 1efd8b75d6df..fd767ad3077b 100644 --- a/test/dotnet.Tests/CommandTests/Reference/Add/AddReferenceParserTests.cs +++ b/test/dotnet.Tests/CommandTests/Reference/Add/AddReferenceParserTests.cs @@ -21,7 +21,7 @@ public AddReferenceParserTests(ITestOutputHelper output) [Fact] public void AddReferenceHasDefaultArgumentSetToCurrentDirectory() { - var result = Parser.Instance.Parse("dotnet add reference my.csproj"); + var result = Parser.Parse(["dotnet", "add", "reference", "my.csproj"]); result.GetValue(AddCommandParser.ProjectArgument) .Should() @@ -32,7 +32,7 @@ public void AddReferenceHasDefaultArgumentSetToCurrentDirectory() [Fact] public void AddReferenceHasInteractiveFlag() { - var result = Parser.Instance.Parse("dotnet add reference my.csproj --interactive"); + var result = Parser.Parse(["dotnet", "add", "reference", "my.csproj", "--interactive"]); result.GetValue(ReferenceAddCommandParser.InteractiveOption) .Should().BeTrue(); @@ -41,7 +41,7 @@ public void AddReferenceHasInteractiveFlag() [Fact] public void AddReferenceWithoutArgumentResultsInAnError() { - var result = Parser.Instance.Parse("dotnet add reference"); + var result = Parser.Parse(["dotnet", "add", "reference"]); result.Errors.Should().NotBeEmpty(); diff --git a/test/dotnet.Tests/CommandTests/Restore/RestoreParserTests.cs b/test/dotnet.Tests/CommandTests/Restore/RestoreParserTests.cs index da9e0fba195d..5a65cbdb98b9 100644 --- a/test/dotnet.Tests/CommandTests/Restore/RestoreParserTests.cs +++ b/test/dotnet.Tests/CommandTests/Restore/RestoreParserTests.cs @@ -19,7 +19,7 @@ public RestoreCommandLineParserTests(ITestOutputHelper output) [Fact] public void RestoreCapturesArgumentsToForwardToMSBuildWhenTargetIsSpecified() { - var result = Parser.Instance.Parse(@"dotnet restore .\some.csproj --packages c:\.nuget\packages /p:SkipInvalidConfigurations=true"); + var result = Parser.Parse(["dotnet", "restore", @".\some.csproj", "--packages", @"c:\.nuget\packages", "/p:SkipInvalidConfigurations=true"]); result.GetValue(RestoreCommandParser.SlnOrProjectOrFileArgument).Should().BeEquivalentTo(@".\some.csproj"); result.OptionValuesToBeForwarded(RestoreCommandParser.GetCommand()).Should().Contain(@"--property:SkipInvalidConfigurations=true"); @@ -28,7 +28,7 @@ public void RestoreCapturesArgumentsToForwardToMSBuildWhenTargetIsSpecified() [Fact] public void RestoreCapturesArgumentsToForwardToMSBuildWhenTargetIsNotSpecified() { - var result = Parser.Instance.Parse(@"dotnet restore --packages c:\.nuget\packages /p:SkipInvalidConfigurations=true"); + var result = Parser.Parse(["dotnet", "restore", "--packages", @"c:\.nuget\packages", "/p:SkipInvalidConfigurations=true"]); result.OptionValuesToBeForwarded(RestoreCommandParser.GetCommand()).Should().Contain(@"--property:SkipInvalidConfigurations=true"); } @@ -37,9 +37,7 @@ public void RestoreCapturesArgumentsToForwardToMSBuildWhenTargetIsNotSpecified() public void RestoreDistinguishesRepeatSourceArgsFromCommandArgs() { var restore = - Parser.Instance - .Parse( - @"dotnet restore --no-cache --packages ""D:\OSS\corefx\packages"" --source https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json --source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json --source https://api.nuget.org/v3/index.json D:\OSS\corefx\external\runtime\runtime.depproj"); + Parser.Parse(["dotnet", "restore", "--no-cache", "--packages", @"D:\OSS\corefx\packages", "--source", "https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json", "--source", "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json", "--source", "https://api.nuget.org/v3/index.json", @"D:\OSS\corefx\external\runtime\runtime.depproj"]); restore.GetValue(RestoreCommandParser.SlnOrProjectOrFileArgument).Should().BeEquivalentTo(@"D:\OSS\corefx\external\runtime\runtime.depproj"); diff --git a/test/dotnet.Tests/CommandTests/Sdk/Check/GivenDotnetSdkCheck.cs b/test/dotnet.Tests/CommandTests/Sdk/Check/GivenDotnetSdkCheck.cs index 02b88a0b7cae..48fee332c933 100644 --- a/test/dotnet.Tests/CommandTests/Sdk/Check/GivenDotnetSdkCheck.cs +++ b/test/dotnet.Tests/CommandTests/Sdk/Check/GivenDotnetSdkCheck.cs @@ -18,10 +18,10 @@ public class GivenDotnetSdkCheck : SdkTest private const string HelpText = @"Description: .NET SDK Check Command - + Usage: dotnet sdk check [options] - + Options: -?, -h, --help Show command line help."; @@ -49,7 +49,7 @@ public void WhenHelpOptionIsPassedItPrintsUsage(string helpArg) [InlineData(false)] public void WhenNewFeatureBandExistsItIsAdvertised(bool newerBandExists) { - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "sdk", "check" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "sdk", "check" }); var oldSdks = GetFakeEnvironmentInfo(new[] { "3.1.100" }, Array.Empty()); var newSdks = GetFakeEnvironmentInfo(new[] { "5.0.100" }, Array.Empty()); @@ -72,7 +72,7 @@ public void WhenNewFeatureBandExistsItIsAdvertised(bool newerBandExists) [Fact] public void ItContainsInfoForAllInstalledBundles() { - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "sdk", "check" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "sdk", "check" }); var bundles = GetFakeEnvironmentInfo(new[] { "1.0.10", "2.1.809", "3.1.402", "5.0.100" }, new[] { "1.1.4", "2.1.8", "3.1.0", "3.1.3", "5.0.0" }); new SdkCheckCommand(parseResult, new MockNETBundleProvider(bundles), new MockProductCollectionProvider(fakeReleasesPath), _reporter).Execute(); @@ -105,7 +105,7 @@ public void ItContainsInfoForAllInstalledBundles() [InlineData(new string[] { "1.1.10", "2.1.300", "2.1.810", "3.1.400" }, new string[] { "1.1.10", "2.1.20", "3.1.0" }, new string[] { "3.1.404", "3.1.10" })] public void WhenANewPatchIsAvailableItIsAdvertised(string[] sdkVersions, string[] runtimeVersions, string[] latestPatchVersions) { - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "sdk", "check" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "sdk", "check" }); var bundles = GetFakeEnvironmentInfo(sdkVersions, runtimeVersions); new SdkCheckCommand(parseResult, new MockNETBundleProvider(bundles), new MockProductCollectionProvider(fakeReleasesPath), _reporter).Execute(); @@ -131,7 +131,7 @@ public void WhenANewPatchIsAvailableItIsAdvertised(string[] sdkVersions, string[ new string[] { "1.0.10", "1.0.9", "2.0.308", "2.1.804", "1.0.0", "1.0.1", "2.0.3", "2.1.8" })] public void WhenABundleIsOutOfSupportItPrintsWarning(string[] sdkVersions, string[] runtimeVersions, string[] outOfSupportVersions) { - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "sdk", "check" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "sdk", "check" }); var bundles = GetFakeEnvironmentInfo(sdkVersions, runtimeVersions); new SdkCheckCommand(parseResult, new MockNETBundleProvider(bundles), new MockProductCollectionProvider(fakeReleasesPath), _reporter).Execute(); @@ -165,7 +165,7 @@ public void WhenABundleIsOutOfSupportItPrintsWarning(string[] sdkVersions, strin [InlineData(new string[] { "1.0.10", "2.0.308", "3.0.309", "3.0.100", "3.1.401" }, new string[] { "1.0.1", "2.0.3", "3.0.3", "3.0.1", "3.1.4" }, new string[] { "3.0.309", "3.0.100", "3.0.3", "3.0.1" })] public void WhenABundleIsInMaintenanceModeItPrintsWarning(string[] sdkVersions, string[] runtimeVersions, string[] maintenanceVersions) { - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "sdk", "check" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "sdk", "check" }); var bundles = GetFakeEnvironmentInfo(sdkVersions, runtimeVersions); new SdkCheckCommand(parseResult, new MockNETBundleProvider(bundles), new MockProductCollectionProvider(fakeReleasesPath), _reporter).Execute(); @@ -192,7 +192,7 @@ public void WhenABundleIsInMaintenanceModeItPrintsWarning(string[] sdkVersions, [Fact] public void ItUsesConfigFile() { - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "sdk", "check" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "sdk", "check" }); var dotnetRoot = _testAssetsManager.CreateTestDirectory().Path; var bundles = GetFakeEnvironmentInfo(new[] { "1.0.10", "2.1.809", "3.1.100", "5.0.100" }, new[] { "1.1.4", "2.1.8", "3.1.0", "3.1.3", "5.0.0" }); var replacementString = "Mock command output"; diff --git a/test/dotnet.Tests/CommandTests/Solution/Add/GivenDotnetSlnAdd.cs b/test/dotnet.Tests/CommandTests/Solution/Add/GivenDotnetSlnAdd.cs index 97d8f36769da..3f78a0896e87 100644 --- a/test/dotnet.Tests/CommandTests/Solution/Add/GivenDotnetSlnAdd.cs +++ b/test/dotnet.Tests/CommandTests/Solution/Add/GivenDotnetSlnAdd.cs @@ -28,17 +28,17 @@ public class GivenDotnetSlnAdd : SdkTest Add one or more projects to a solution file. Usage: - dotnet solution add [...] [options] + dotnet solution [] add [...] [options] Arguments: - The solution file to operate on. If not specified, the command will search the current directory for one. [default: {PathUtility.EnsureTrailingSlash(defaultVal)}] - The paths to the projects to add to the solution. + The solution file to operate on. If not specified, the command will search the current directory for one. [default: {PathUtility.EnsureTrailingSlash(defaultVal)}] + The paths to the projects to add to the solution. Options: - --in-root Place project in root of the solution, rather than creating a solution folder. - -s, --solution-folder The destination solution folder path to add the projects to. - --include-references Recursively add projects' ReferencedProjects to solution [default: True] - -?, -h, --help Show command line help"; + --in-root Place project in root of the solution, rather than creating a solution folder. [default: False] + -s, --solution-folder The destination solution folder path to add the projects to. + --include-references Recursively add projects' ReferencedProjects to solution [default: True] + -?, -h, --help Show command line help"; public GivenDotnetSlnAdd(ITestOutputHelper log) : base(log) { diff --git a/test/dotnet.Tests/CommandTests/Solution/List/GivenDotnetSlnList.cs b/test/dotnet.Tests/CommandTests/Solution/List/GivenDotnetSlnList.cs index a8be1242424e..fbd8fcab1ed9 100644 --- a/test/dotnet.Tests/CommandTests/Solution/List/GivenDotnetSlnList.cs +++ b/test/dotnet.Tests/CommandTests/Solution/List/GivenDotnetSlnList.cs @@ -12,14 +12,14 @@ public class GivenDotnetSlnList : SdkTest List all projects in a solution file. Usage: - dotnet solution list [options] + dotnet solution [] list [options] Arguments: - The solution file to operate on. If not specified, the command will search the current directory for one. [default: {PathUtility.EnsureTrailingSlash(defaultVal)}] + The solution file to operate on. If not specified, the command will search the current directory for one. [default: {PathUtility.EnsureTrailingSlash(defaultVal)}] Options: - --solution-folders Display solution folder paths. - -?, -h, --help Show command line help."; + --solution-folders Display solution folder paths. [default: False] + -?, -h, --help Show command line help."; public GivenDotnetSlnList(ITestOutputHelper log) : base(log) diff --git a/test/dotnet.Tests/CommandTests/Tool/Install/InstallToolParserTests.cs b/test/dotnet.Tests/CommandTests/Tool/Install/InstallToolParserTests.cs index 08b44958c85f..53a5c5dd31ed 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Install/InstallToolParserTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Install/InstallToolParserTests.cs @@ -24,7 +24,7 @@ public InstallToolParserTests(ITestOutputHelper output) [InlineData("console.test.app@1.*", "1.*")] public void InstallGlobalToolParserCanGetPackageIdentityWithVersion(string arguments, string expectedVersion) { - var result = Parser.Instance.Parse($"dotnet tool install -g {arguments}"); + var result = Parser.Parse($"dotnet tool install -g {arguments}"); var packageIdentity = result.GetValue(ToolInstallCommandParser.PackageIdentityArgument); var packageId = packageIdentity.Id; var packageVersion = packageIdentity.VersionRange?.OriginalString ?? result.GetValue(ToolInstallCommandParser.VersionOption); @@ -36,7 +36,7 @@ public void InstallGlobalToolParserCanGetPackageIdentityWithVersion(string argum public void InstallGlobaltoolParserCanGetFollowingArguments() { var result = - Parser.Instance.Parse( + Parser.Parse( $@"dotnet tool install -g console.test.app --version 1.0.1 --framework {ToolsetInfo.CurrentTargetFramework} --configfile C:\TestAssetLocalNugetFeed"); result.GetRequiredValue(ToolInstallCommandParser.ConfigOption).Should().Be(@"C:\TestAssetLocalNugetFeed"); @@ -49,7 +49,7 @@ public void InstallToolParserCanParseSourceOption() const string expectedSourceValue = "TestSourceValue"; var result = - Parser.Instance.Parse($"dotnet tool install -g --add-source {expectedSourceValue} console.test.app"); + Parser.Parse($"dotnet tool install -g --add-source {expectedSourceValue} console.test.app"); result.GetRequiredValue(ToolInstallCommandParser.AddSourceOption).First().Should().Be(expectedSourceValue); } @@ -61,7 +61,7 @@ public void InstallToolParserCanParseMultipleSourceOption() const string expectedSourceValue2 = "TestSourceValue2"; var result = - Parser.Instance.Parse( + Parser.Parse( $"dotnet tool install -g " + $"--add-source {expectedSourceValue1} " + $"--add-source {expectedSourceValue2} console.test.app"); @@ -74,7 +74,7 @@ public void InstallToolParserCanParseMultipleSourceOption() [Fact] public void InstallToolParserCanGetGlobalOption() { - var result = Parser.Instance.Parse("dotnet tool install -g console.test.app"); + var result = Parser.Parse("dotnet tool install -g console.test.app"); result.GetRequiredValue(ToolInstallCommandParser.GlobalOption).Should().Be(true); } @@ -82,7 +82,7 @@ public void InstallToolParserCanGetGlobalOption() [Fact] public void InstallToolParserCanGetLocalOption() { - var result = Parser.Instance.Parse("dotnet tool install --local console.test.app"); + var result = Parser.Parse("dotnet tool install --local console.test.app"); result.GetRequiredValue(ToolInstallCommandParser.LocalOption).Should().Be(true); } @@ -91,7 +91,7 @@ public void InstallToolParserCanGetLocalOption() public void InstallToolParserCanGetManifestOption() { var result = - Parser.Instance.Parse( + Parser.Parse( "dotnet tool install --local console.test.app --tool-manifest folder/my-manifest.format"); result.GetRequiredValue(ToolInstallCommandParser.ToolManifestOption).Should().Be("folder/my-manifest.format"); @@ -102,7 +102,7 @@ public void InstallToolParserCanParseVerbosityOption() { const string expectedVerbosityLevel = "diag"; - var result = Parser.Instance.Parse($"dotnet tool install -g --verbosity:{expectedVerbosityLevel} console.test.app"); + var result = Parser.Parse($"dotnet tool install -g --verbosity:{expectedVerbosityLevel} console.test.app"); Enum.GetName(result.GetRequiredValue(ToolInstallCommandParser.VerbosityOption)).Should().Be(expectedVerbosityLevel); } @@ -111,7 +111,7 @@ public void InstallToolParserCanParseVerbosityOption() public void InstallToolParserCanParseToolPathOption() { var result = - Parser.Instance.Parse(@"dotnet tool install --tool-path C:\Tools console.test.app"); + Parser.Parse(@"dotnet tool install --tool-path C:\Tools console.test.app"); result.GetRequiredValue(ToolInstallCommandParser.ToolPathOption).Should().Be(@"C:\Tools"); } @@ -120,7 +120,7 @@ public void InstallToolParserCanParseToolPathOption() public void InstallToolParserCanParseNoCacheOption() { var result = - Parser.Instance.Parse(@"dotnet tool install -g console.test.app --no-cache"); + Parser.Parse(@"dotnet tool install -g console.test.app --no-cache"); result.GetRequiredValue(ToolCommandRestorePassThroughOptions.NoCacheOption).Should().BeTrue(); } @@ -129,7 +129,7 @@ public void InstallToolParserCanParseNoCacheOption() public void InstallToolParserCanParseNoHttpCacheOption() { var result = - Parser.Instance.Parse(@"dotnet tool install -g console.test.app --no-http-cache"); + Parser.Parse(@"dotnet tool install -g console.test.app --no-http-cache"); result.GetRequiredValue(ToolCommandRestorePassThroughOptions.NoHttpCacheOption).Should().BeTrue(); } @@ -138,7 +138,7 @@ public void InstallToolParserCanParseNoHttpCacheOption() public void InstallToolParserCanParseIgnoreFailedSourcesOption() { var result = - Parser.Instance.Parse(@"dotnet tool install -g console.test.app --ignore-failed-sources"); + Parser.Parse(@"dotnet tool install -g console.test.app --ignore-failed-sources"); result.GetRequiredValue(ToolCommandRestorePassThroughOptions.IgnoreFailedSourcesOption).Should().BeTrue(); } @@ -147,7 +147,7 @@ public void InstallToolParserCanParseIgnoreFailedSourcesOption() public void InstallToolParserCanParseDisableParallelOption() { var result = - Parser.Instance.Parse(@"dotnet tool install -g console.test.app --disable-parallel"); + Parser.Parse(@"dotnet tool install -g console.test.app --disable-parallel"); result.GetRequiredValue(ToolCommandRestorePassThroughOptions.DisableParallelOption).Should().BeTrue(); } @@ -156,7 +156,7 @@ public void InstallToolParserCanParseDisableParallelOption() public void InstallToolParserCanParseInteractiveRestoreOption() { var result = - Parser.Instance.Parse(@"dotnet tool install -g console.test.app --interactive"); + Parser.Parse(@"dotnet tool install -g console.test.app --interactive"); result.GetRequiredValue(ToolCommandRestorePassThroughOptions.InteractiveRestoreOption).Should().BeTrue(); } diff --git a/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallCommandTests.cs index 3ee843239348..6bbafee79c87 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallCommandTests.cs @@ -20,7 +20,7 @@ public ToolInstallCommandTests(ITestOutputHelper log) : base(log) [Fact] public void WhenRunWithBothGlobalAndToolPathShowErrorMessage() { - var parseResult = Parser.Instance.Parse($"dotnet tool install -g --tool-path /tmp/folder {PackageId}"); + var parseResult = Parser.Parse($"dotnet tool install -g --tool-path /tmp/folder {PackageId}"); var toolInstallCommand = new ToolInstallCommand( parseResult); @@ -44,15 +44,15 @@ public void WhenRunWithRoot() Directory.SetCurrentDirectory("/tmp/folder"); new DotnetNewCommand(Log, "tool-manifest").WithCustomHive("/tmp/folder").WithWorkingDirectory("/tmp/folder").Execute().Should().Pass(); - var parseResult = Parser.Instance.Parse("tool install dotnetsay"); + var parseResult = Parser.Parse("tool install dotnetsay"); new ToolInstallLocalCommand(parseResult, runtimeJsonPathForTests: ridGraphPath).Execute().Should().Be(0); Directory.SetCurrentDirectory("/tmp/folder/sub"); new DotnetNewCommand(Log, "tool-manifest").WithCustomHive("/tmp/folder/sub").WithWorkingDirectory("/tmp/folder/sub").Execute().Should().Pass(); - parseResult = Parser.Instance.Parse("tool install dotnetsay"); + parseResult = Parser.Parse("tool install dotnetsay"); new ToolInstallLocalCommand(parseResult, runtimeJsonPathForTests: ridGraphPath).Execute().Should().Be(0); - new ToolRunCommand(Parser.Instance.Parse($"tool run dotnetsay")).Execute().Should().Be(0); + new ToolRunCommand(Parser.Parse($"tool run dotnetsay")).Execute().Should().Be(0); } finally { @@ -63,7 +63,7 @@ public void WhenRunWithRoot() [Fact] public void WhenRunWithBothGlobalAndLocalShowErrorMessage() { - var parseResult = Parser.Instance.Parse( + var parseResult = Parser.Parse( new[] { "dotnet", "tool", "install", "--local", "--tool-path", "/tmp/folder", PackageId }); var toolInstallCommand = new ToolInstallCommand( @@ -80,7 +80,7 @@ public void WhenRunWithBothGlobalAndLocalShowErrorMessage() [Fact] public void WhenRunWithGlobalAndToolManifestShowErrorMessage() { - var parseResult = Parser.Instance.Parse( + var parseResult = Parser.Parse( new[] { "dotnet", "tool", "install", "-g", "--tool-manifest", "folder/my-manifest.format", "PackageId" }); var toolInstallCommand = new ToolInstallCommand( @@ -95,7 +95,7 @@ public void WhenRunWithGlobalAndToolManifestShowErrorMessage() [Fact] public void WhenRunWithToolPathAndToolManifestShowErrorMessage() { - var parseResult = Parser.Instance.Parse( + var parseResult = Parser.Parse( new[] { "dotnet", "tool", "install", "--tool-path", "/tmp/folder", "--tool-manifest", "folder/my-manifest.format", PackageId @@ -113,7 +113,7 @@ public void WhenRunWithToolPathAndToolManifestShowErrorMessage() [Fact] public void WhenRunWithLocalAndFrameworkShowErrorMessage() { - var parseResult = Parser.Instance.Parse( + var parseResult = Parser.Parse( new[] { "dotnet", "tool", "install", PackageId, "--framework", ToolsetInfo.CurrentTargetFramework diff --git a/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallGlobalOrToolPathCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallGlobalOrToolPathCommandTests.cs index 43184db6b930..ea127f2fbba0 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallGlobalOrToolPathCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallGlobalOrToolPathCommandTests.cs @@ -81,13 +81,13 @@ public ToolInstallGlobalOrToolPathCommandTests(ITestOutputHelper log): base(log) _createToolPackageStoreDownloaderUninstaller = (location, forwardArguments, workingDirectory) => (_toolPackageStore, _toolPackageStoreQuery, _toolPackageDownloader, _toolPackageUninstallerMock); - _parseResult = Parser.Instance.Parse($"dotnet tool install -g {PackageId}"); + _parseResult = Parser.Parse($"dotnet tool install -g {PackageId}"); } [Fact] public void WhenPassingRestoreActionConfigOptions() { - var parseResult = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --ignore-failed-sources"); + var parseResult = Parser.Parse($"dotnet tool install -g {PackageId} --ignore-failed-sources"); var toolInstallCommand = new ToolInstallGlobalOrToolPathCommand(parseResult); toolInstallCommand.restoreActionConfig.IgnoreFailedSources.Should().BeTrue(); } @@ -98,7 +98,7 @@ public void WhenPassingIgnoreFailedSourcesItShouldNotThrow() _fileSystem.File.WriteAllText(Path.Combine(_temporaryDirectory, "nuget.config"), _nugetConfigWithInvalidSources); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( - Parser.Instance.Parse($"dotnet tool install -g {PackageId} --ignore-failed-sources"), + Parser.Parse($"dotnet tool install -g {PackageId} --ignore-failed-sources"), _packageId, _createToolPackageStoreDownloaderUninstaller, _createShellShimRepository, @@ -177,7 +177,7 @@ public void WhenRunFromToolInstallRedirectCommandWithPackageIdItShouldCreateVali public void WhenRunWithSourceItShouldFindOnlyTheProvidedSource() { const string sourcePath1 = "https://sourceOne.com"; - ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --source {sourcePath1}"); + ParseResult result = Parser.Parse($"dotnet tool install -g {PackageId} --source {sourcePath1}"); _toolPackageDownloader.MockFeedWithNoPackages = sourcePath1; @@ -198,7 +198,7 @@ public void WhenRunWithSourceItShouldFindOnlyTheProvidedSource() public void WhenRunWithPackageIdWithSourceItShouldCreateValidShim() { const string sourcePath = "http://mysource.com"; - ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --add-source {sourcePath}"); + ParseResult result = Parser.Parse($"dotnet tool install -g {PackageId} --add-source {sourcePath}"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( result, @@ -357,7 +357,7 @@ public void WhenRunWithPackageIdItShouldShowSuccessMessage() [Fact] public void WhenRunWithPackageIdWithQuietItShouldShowNoSuccessMessage() { - var parseResultQuiet = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --verbosity quiet"); + var parseResultQuiet = Parser.Parse($"dotnet tool install -g {PackageId} --verbosity quiet"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( parseResultQuiet, _packageId, @@ -382,7 +382,7 @@ public void WhenRunWithPackageIdWithQuietItShouldShowNoSuccessMessage() public void WhenRunWithInvalidVersionItShouldThrow() { const string invalidVersion = "!NotValidVersion!"; - ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version {invalidVersion}"); + ParseResult result = Parser.Parse($"dotnet tool install -g {PackageId} --version {invalidVersion}"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( result, @@ -404,7 +404,7 @@ public void WhenRunWithInvalidVersionItShouldThrow() [Fact] public void WhenRunWithExactVersionItShouldSucceed() { - ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version {PackageVersion}"); + ParseResult result = Parser.Parse($"dotnet tool install -g {PackageId} --version {PackageVersion}"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( result, @@ -429,7 +429,7 @@ public void WhenRunWithExactVersionItShouldSucceed() [Fact] public void WhenInstallTheSpecificSameVersionTwiceItShouldNoop() { - ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version {PackageVersion}"); + ParseResult result = Parser.Parse($"dotnet tool install -g {PackageId} --version {PackageVersion}"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( result, @@ -461,7 +461,7 @@ public void WhenInstallWithHigherVersionItShouldUpdate() { AddHigherToolPackageVersionToFeed(); - ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version {PackageVersion}"); + ParseResult result = Parser.Parse($"dotnet tool install -g {PackageId} --version {PackageVersion}"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( result, @@ -483,7 +483,7 @@ public void WhenInstallWithHigherVersionItShouldUpdate() PackageVersion).Green()); _reporter.Clear(); - ParseResult result2 = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version {HigherPackageVersion}"); + ParseResult result2 = Parser.Parse($"dotnet tool install -g {PackageId} --version {HigherPackageVersion}"); var toolInstallGlobalOrToolPathCommand2 = new ToolInstallGlobalOrToolPathCommand( result2, @@ -510,7 +510,7 @@ public void WhenInstallWithLowerVersionWithAllowDowngradeOptionItShouldDowngrade { AddLowerToolPackageVersionToFeed(); - ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version {PackageVersion}"); + ParseResult result = Parser.Parse($"dotnet tool install -g {PackageId} --version {PackageVersion}"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( result, @@ -532,7 +532,7 @@ public void WhenInstallWithLowerVersionWithAllowDowngradeOptionItShouldDowngrade PackageVersion).Green()); _reporter.Clear(); - ParseResult result2 = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version {LowerPackageVersion} --allow-downgrade"); + ParseResult result2 = Parser.Parse($"dotnet tool install -g {PackageId} --version {LowerPackageVersion} --allow-downgrade"); var toolInstallGlobalOrToolPathCommand2 = new ToolInstallGlobalOrToolPathCommand( result2, @@ -558,8 +558,8 @@ public void WhenInstallWithLowerVersionWithAllowDowngradeOptionItShouldDowngrade public void WhenInstallWithLowerVersionItShouldFail() { AddLowerToolPackageVersionToFeed(); - - ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version {PackageVersion}"); + + ParseResult result = Parser.Parse($"dotnet tool install -g {PackageId} --version {PackageVersion}"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( result, @@ -581,7 +581,7 @@ public void WhenInstallWithLowerVersionItShouldFail() PackageVersion).Green()); _reporter.Clear(); - ParseResult result2 = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version {LowerPackageVersion}"); + ParseResult result2 = Parser.Parse($"dotnet tool install -g {PackageId} --version {LowerPackageVersion}"); var toolInstallGlobalOrToolPathCommand2 = new ToolInstallGlobalOrToolPathCommand( result2, @@ -598,7 +598,7 @@ public void WhenInstallWithLowerVersionItShouldFail() [Fact] public void WhenRunWithValidVersionRangeItShouldSucceed() { - ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version [1.0,2.0]"); + ParseResult result = Parser.Parse($"dotnet tool install -g {PackageId} --version [1.0,2.0]"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( result, @@ -629,7 +629,7 @@ public void WhenRunWithValidVersionItShouldInterpretAsNuGetExactVersion(string v var testDir = _testAssetsManager.CreateTestDirectory().Path; var ridGraphPath = TestContext.GetRuntimeGraphFilePath(); - var toolInstallCommand = new ToolInstallGlobalOrToolPathCommand(Parser.Instance.Parse($"dotnet tool install -g {UnlistedPackageId} --version {version} --add-source {nugetSourcePath}"), + var toolInstallCommand = new ToolInstallGlobalOrToolPathCommand(Parser.Parse($"dotnet tool install -g {UnlistedPackageId} --version {version} --add-source {nugetSourcePath}"), createToolPackageStoreDownloaderUninstaller: (nonGlobalLocation, _, _) => { ToolPackageStoreAndQuery toolPackageStore = ToolPackageFactory.CreateToolPackageStoreQuery(nonGlobalLocation); @@ -647,7 +647,7 @@ public void WhenRunWithValidVersionItShouldInterpretAsNuGetExactVersion(string v toolInstallCommand.Execute().Should().Be(0); // Uninstall the unlisted package - var toolUninstallCommand = new ToolUninstallGlobalOrToolPathCommand(Parser.Instance.Parse("dotnet tool uninstall -g " + UnlistedPackageId), + var toolUninstallCommand = new ToolUninstallGlobalOrToolPathCommand(Parser.Parse("dotnet tool uninstall -g " + UnlistedPackageId), // This is technically not _createShellShimRepository because that is a Microsoft.DotNet.Tools.Tool.Install.CreateShellShimRepository. // This is a Microsoft.DotNet.Tools.Tool.Uninstall.CreateShellShimRepository. createShellShimRepository: (_, nonGlobalLocation) => new ShellShimRepository( @@ -677,7 +677,7 @@ public void WhenRunWithPrereleaseItShouldSucceed() { AddPreviewToolPackageVersionToFeed(); - ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --prerelease"); + ParseResult result = Parser.Parse($"dotnet tool install -g {PackageId} --prerelease"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( result, @@ -704,7 +704,7 @@ public void WhenRunWithPrereleaseAndPackageVersionItShouldThrow() { AddPreviewToolPackageVersionToFeed(); - ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version 2.0 --prerelease"); + ParseResult result = Parser.Parse($"dotnet tool install -g {PackageId} --version 2.0 --prerelease"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( result, @@ -753,7 +753,7 @@ private void AddLowerToolPackageVersionToFeed() }); } - + private void AddHigherToolPackageVersionToFeed() { _toolPackageDownloader.AddMockPackage(new MockFeedPackage @@ -774,7 +774,7 @@ private void AddHigherToolPackageVersionToFeed() [Fact] public void WhenRunWithoutAMatchingRangeItShouldFail() { - ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version [5.0,10.0]"); + ParseResult result = Parser.Parse($"dotnet tool install -g {PackageId} --version [5.0,10.0]"); _toolPackageDownloader.AddMockPackage(new MockFeedPackage() { @@ -802,7 +802,7 @@ public void WhenRunWithoutAMatchingRangeItShouldFail() [Fact] public void WhenRunWithValidVersionWildcardItShouldSucceed() { - ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version 1.0.*"); + ParseResult result = Parser.Parse($"dotnet tool install -g {PackageId} --version 1.0.*"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( result, @@ -827,7 +827,7 @@ public void WhenRunWithValidVersionWildcardItShouldSucceed() [Fact] public void WhenRunWithPackageIdAndBinPathItShouldNoteHaveEnvironmentPathInstruction() { - var result = Parser.Instance.Parse($"dotnet tool install --tool-path /tmp/folder {PackageId}"); + var result = Parser.Parse($"dotnet tool install --tool-path /tmp/folder {PackageId}"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( result, @@ -864,7 +864,7 @@ public void AndPackagedShimIsProvidedWhenRunWithPackageIdItCreateShimUsingPackag var tokenToIdentifyPackagedShim = $"{toolTargetRuntimeIdentifier}-tool"; - var result = Parser.Instance.Parse($"dotnet tool install --tool-path /tmp/folder {PackageId}"); + var result = Parser.Parse($"dotnet tool install --tool-path /tmp/folder {PackageId}"); var mockPackage = new MockFeedPackage() @@ -895,7 +895,7 @@ public void AndPackagedShimIsProvidedWhenRunWithPackageIdItCreateShimUsingPackag public void WhenRunWithArchOptionItErrorsOnInvalidRids() { _reporter.Clear(); - var parseResult = Parser.Instance.Parse($"dotnet tool install -g {PackageId} -a invalid"); + var parseResult = Parser.Parse($"dotnet tool install -g {PackageId} -a invalid"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( parseResult, _packageId, @@ -912,7 +912,7 @@ public void WhenRunWithArchOptionItErrorsOnInvalidRids() public void WhenRunWithArchOptionItDownloadsAppHostTemplate() { var nugetPackageDownloader = new MockNuGetPackageDownloader(); - var parseResult = Parser.Instance.Parse($"dotnet tool install -g {PackageId} -a arm64"); + var parseResult = Parser.Parse($"dotnet tool install -g {PackageId} -a arm64"); var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand( parseResult, _packageId, diff --git a/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallLocalCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallLocalCommandTests.cs index 4d2f56d0af57..d1c1fed817f0 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallLocalCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallLocalCommandTests.cs @@ -50,7 +50,7 @@ public ToolInstallLocalCommandTests(ITestOutputHelper log) : base(log) ToolPackageStoreMock toolPackageStoreMock = new(new DirectoryPath(_pathToPlacePackages), _fileSystem); _toolPackageStore = toolPackageStoreMock; - + _toolPackageDownloaderMock = new ToolPackageDownloaderMock( store: _toolPackageStore, fileSystem: _fileSystem, @@ -83,7 +83,7 @@ public ToolInstallLocalCommandTests(ITestOutputHelper log) : base(log) _toolManifestFinder = new ToolManifestFinder(new DirectoryPath(_temporaryDirectory), _fileSystem, new FakeDangerousFileDetector()); _toolManifestEditor = new ToolManifestEditor(_fileSystem); - _parseResult = Parser.Instance.Parse($"dotnet tool install {_packageIdA.ToString()}"); + _parseResult = Parser.Parse($"dotnet tool install {_packageIdA.ToString()}"); _localToolsResolverCache = new LocalToolsResolverCache( @@ -94,7 +94,7 @@ public ToolInstallLocalCommandTests(ITestOutputHelper log) : base(log) [Fact] public void WhenPassingRestoreActionConfigOptions() { - var parseResult = Parser.Instance.Parse($"dotnet tool install {_packageIdA.ToString()} --ignore-failed-sources"); + var parseResult = Parser.Parse($"dotnet tool install {_packageIdA.ToString()} --ignore-failed-sources"); var toolInstallCommand = new ToolInstallLocalCommand(parseResult); toolInstallCommand.restoreActionConfig.IgnoreFailedSources.Should().BeTrue(); } @@ -103,7 +103,7 @@ public void WhenPassingRestoreActionConfigOptions() public void WhenPassingIgnoreFailedSourcesItShouldNotThrow() { _fileSystem.File.WriteAllText(Path.Combine(_temporaryDirectory, "nuget.config"), _nugetConfigWithInvalidSources); - var parseResult = Parser.Instance.Parse($"dotnet tool install {_packageIdA.ToString()} --ignore-failed-sources"); + var parseResult = Parser.Parse($"dotnet tool install {_packageIdA.ToString()} --ignore-failed-sources"); var toolInstallCommand = new ToolInstallLocalCommand(parseResult, _packageIdA, _toolPackageDownloaderMock, @@ -132,7 +132,7 @@ public void GivenCreateManifestIfNeededWithoutArgumentTheDefaultIsTrueForLegacyB { _fileSystem.File.Delete(_manifestFilePath); ParseResult parseResult = - Parser.Instance.Parse( + Parser.Parse( $"dotnet tool install {_packageIdA.ToString()} --create-manifest-if-needed"); var toolInstallLocalCommand = new ToolInstallLocalCommand( @@ -152,7 +152,7 @@ public void GivenNoManifestFileItShouldThrowAndContainNoManifestGuide() { _fileSystem.File.Delete(_manifestFilePath); ParseResult parseResult = - Parser.Instance.Parse( + Parser.Parse( $"dotnet tool install {_packageIdA.ToString()} --create-manifest-if-needed false"); var toolInstallLocalCommand = new ToolInstallLocalCommand( @@ -180,7 +180,7 @@ public void WhenRunWithExplicitManifestFileItShouldAddEntryToExplicitManifestFil _fileSystem.File.WriteAllText(explicitManifestFilePath, _jsonContent); ParseResult parseResult = - Parser.Instance.Parse( + Parser.Parse( $"dotnet tool install {_packageIdA.ToString()} --tool-manifest {explicitManifestFilePath}"); var installLocalCommand = new ToolInstallLocalCommand( @@ -200,7 +200,7 @@ public void WhenRunWithExplicitManifestFileItShouldAddEntryToExplicitManifestFil public void WhenRunWithRollForwardItShouldRollForwardToTrueInManifestFile() { ParseResult parseResult = - Parser.Instance.Parse( + Parser.Parse( $"dotnet tool install {_packageIdA.ToString()} --allow-roll-forward"); var installLocalCommand = new ToolInstallLocalCommand( @@ -221,7 +221,7 @@ public void WhenRunWithRollForwardItShouldRollForwardToTrueInManifestFile() public void WhenRunWithoutRollForwardItShouldDefaultRollForwardToFalseInManifestFile() { ParseResult parseResult = - Parser.Instance.Parse( + Parser.Parse( $"dotnet tool install {_packageIdA.ToString()}"); var installLocalCommand = new ToolInstallLocalCommand( @@ -270,7 +270,7 @@ public void WhenRunWithPackageIdItShouldShowSuccessMessage() [Fact] public void GivenFailedPackageInstallWhenRunWithPackageIdItShouldNotChangeManifestFile() { - ParseResult result = Parser.Instance.Parse($"dotnet tool install non-exist"); + ParseResult result = Parser.Parse($"dotnet tool install non-exist"); var installLocalCommand = new ToolInstallLocalCommand( result, @@ -330,7 +330,7 @@ private ToolInstallLocalCommand GetDefaultTestToolInstallLocalCommand() [Fact] public void WhenRunWithExactVersionItShouldSucceed() { - ParseResult result = Parser.Instance.Parse( + ParseResult result = Parser.Parse( $"dotnet tool install {_packageIdA.ToString()} --version {_packageVersionA.ToNormalizedString()}"); var installLocalCommand = new ToolInstallLocalCommand( @@ -349,7 +349,7 @@ public void WhenRunWithExactVersionItShouldSucceed() [Fact] public void WhenRunWithValidVersionRangeItShouldSucceed() { - ParseResult result = Parser.Instance.Parse( + ParseResult result = Parser.Parse( $"dotnet tool install {_packageIdA.ToString()} --version 1.*"); var installLocalCommand = new ToolInstallLocalCommand( @@ -369,7 +369,7 @@ public void WhenRunWithValidVersionRangeItShouldSucceed() public void WhenRunWithPrereleaseAndPackageVersionItShouldSucceed() { ParseResult result = - Parser.Instance.Parse($"dotnet tool install {_packageIdA.ToString()} --prerelease"); + Parser.Parse($"dotnet tool install {_packageIdA.ToString()} --prerelease"); var installLocalCommand = new ToolInstallLocalCommand( result, @@ -405,7 +405,7 @@ public void GivenNoManifestFileAndCreateManifestIfNeededFlagItShouldCreateManife _fileSystem.Directory.CreateDirectory(currentFolder); ParseResult parseResult = - Parser.Instance.Parse( + Parser.Parse( $"dotnet tool install {_packageIdA.ToString()} --create-manifest-if-needed"); var installLocalCommand = new ToolInstallLocalCommand( @@ -427,7 +427,7 @@ public void GivenNoManifestFileItUsesCreateManifestIfNeededByDefault() _fileSystem.File.Delete(_manifestFilePath); ParseResult parseResult = - Parser.Instance.Parse( + Parser.Parse( $"dotnet tool install {_packageIdA.ToString()}"); var installLocalCommand = new ToolInstallLocalCommand( @@ -452,7 +452,7 @@ public void GivenNoManifestFileAndCreateManifestIfNeededFlagItShouldCreateManife _fileSystem.Directory.CreateDirectory(currentFolder); ParseResult parseResult = - Parser.Instance.Parse( + Parser.Parse( $"dotnet tool install {_packageIdA.ToString()} --create-manifest-if-needed"); var installLocalCommand = new ToolInstallLocalCommand( @@ -474,7 +474,7 @@ public void GivenNoManifestFileAndCreateManifestIfNeededFlagItShouldCreateManife _fileSystem.File.Delete(_manifestFilePath); ParseResult parseResult = - Parser.Instance.Parse( + Parser.Parse( $"dotnet tool install {_packageIdA.ToString()} --create-manifest-if-needed"); var installLocalCommand = new ToolInstallLocalCommand( diff --git a/test/dotnet.Tests/CommandTests/Tool/List/ListToolParserTests.cs b/test/dotnet.Tests/CommandTests/Tool/List/ListToolParserTests.cs index d32cbdfd67cb..838eb4ee19a0 100644 --- a/test/dotnet.Tests/CommandTests/Tool/List/ListToolParserTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/List/ListToolParserTests.cs @@ -18,7 +18,7 @@ public ListToolParserTests(ITestOutputHelper output) [Fact] public void ListToolParserCanGetGlobalOption() { - var result = Parser.Instance.Parse("dotnet tool list -g"); + var result = Parser.Parse("dotnet tool list -g"); result.GetValue(ToolListCommandParser.GlobalOption).Should().Be(true); } @@ -26,7 +26,7 @@ public void ListToolParserCanGetGlobalOption() [Fact] public void ListToolParserCanGetLocalOption() { - var result = Parser.Instance.Parse("dotnet tool list --local"); + var result = Parser.Parse("dotnet tool list --local"); result.GetValue(ToolListCommandParser.LocalOption).Should().Be(true); } @@ -35,7 +35,7 @@ public void ListToolParserCanGetLocalOption() public void ListToolParserCanParseToolPathOption() { var result = - Parser.Instance.Parse(@"dotnet tool list --tool-path C:\Tools "); + Parser.Parse(@"dotnet tool list --tool-path C:\Tools "); result.GetValue(ToolListCommandParser.ToolPathOption).Should().Be(@"C:\Tools"); } diff --git a/test/dotnet.Tests/CommandTests/Tool/List/ToolListCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/List/ToolListCommandTests.cs index 1d9e59f31413..6c9ae4626b55 100644 --- a/test/dotnet.Tests/CommandTests/Tool/List/ToolListCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/List/ToolListCommandTests.cs @@ -13,7 +13,7 @@ public class ToolListCommandTests [Fact] public void WhenRunWithBothGlobalAndToolPathShowErrorMessage() { - var result = Parser.Instance.Parse($"dotnet tool list -g --tool-path /test/path"); + var result = Parser.Parse($"dotnet tool list -g --tool-path /test/path"); var toolInstallCommand = new ToolListCommand( result); @@ -29,7 +29,7 @@ public void WhenRunWithBothGlobalAndToolPathShowErrorMessage() [Fact] public void WhenRunWithBothGlobalAndLocalShowErrorMessage() { - var result = Parser.Instance.Parse($"dotnet tool list --local --tool-path /test/path"); + var result = Parser.Parse($"dotnet tool list --local --tool-path /test/path"); var toolInstallCommand = new ToolListCommand( result); diff --git a/test/dotnet.Tests/CommandTests/Tool/List/ToolListGlobalOrToolPathCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/List/ToolListGlobalOrToolPathCommandTests.cs index 2f5840f20df2..d24158e21861 100644 --- a/test/dotnet.Tests/CommandTests/Tool/List/ToolListGlobalOrToolPathCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/List/ToolListGlobalOrToolPathCommandTests.cs @@ -85,7 +85,7 @@ public void GivenAToolPathItPassesToolPathToStoreFactoryFromRedirectCommand() .Returns(new IToolPackage[0]); var toolPath = Path.GetTempPath(); - var result = Parser.Instance.Parse("dotnet tool list " + $"--tool-path {toolPath}"); + var result = Parser.Parse("dotnet tool list " + $"--tool-path {toolPath}"); var toolListGlobalOrToolPathCommand = new ToolListGlobalOrToolPathCommand( result, toolPath1 => @@ -156,7 +156,7 @@ public void GivenMultipleInstalledPackagesItPrintsThePackages() _reporter.Lines.Should().Equal(EnumerateExpectedTableLines(store.Object)); } - + [Fact] public void GivenMultipleInstalledPackagesItPrintsThePackagesForJsonFormat() { @@ -181,12 +181,12 @@ public void GivenMultipleInstalledPackagesItPrintsThePackagesForJsonFormat() command.Execute().Should().Be(0); _reporter.Lines.Count.Should().Be(1); - + var versionedData = System.Text.Json.JsonSerializer.Deserialize>(_reporter.Lines[0]); versionedData.Should().NotBeNull(); versionedData.Version.Should().Be(1); versionedData.Data.Length.Should().Be(2); - + // another tool should be the first one, since there's OrderBy by PackageId versionedData.Data[0].PackageId.Should().Be("another.tool"); versionedData.Data[0].Version.Should().Be("2.7.3"); @@ -323,7 +323,7 @@ private IToolPackage CreateMockBrokenPackage(string id, string version) private ToolListGlobalOrToolPathCommand CreateCommand(IToolPackageStoreQuery store, string options = "", string expectedToolPath = null) { - var result = Parser.Instance.Parse("dotnet tool list " + options); + var result = Parser.Parse("dotnet tool list " + options); return new ToolListGlobalOrToolPathCommand( result, toolPath => { AssertExpectedToolPath(toolPath, expectedToolPath); return store; }, diff --git a/test/dotnet.Tests/CommandTests/Tool/List/ToolListLocalCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/List/ToolListLocalCommandTests.cs index d17407773f88..ac3b40a90ee8 100644 --- a/test/dotnet.Tests/CommandTests/Tool/List/ToolListLocalCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/List/ToolListLocalCommandTests.cs @@ -47,7 +47,7 @@ public ToolListLocalCommandTests() false), new FilePath(_testManifestPath)) } ); - _parseResult = Parser.Instance.Parse("dotnet tool list"); + _parseResult = Parser.Parse("dotnet tool list"); _defaultToolListLocalCommand = new ToolListLocalCommand( _parseResult, _toolManifestInspector, @@ -73,7 +73,7 @@ public void GivenManifestInspectorItPrintsTheTable() public void GivenManifestInspectorItPrintsJson() { new ToolListLocalCommand( - Parser.Instance.Parse("dotnet tool list --format json"), + Parser.Parse("dotnet tool list --format json"), _toolManifestInspector, _reporter).Execute(); _reporter.Lines.Count.Should().Be(1); @@ -131,7 +131,7 @@ public void GivenNotInstalledPackageItPrintsEmpty() private ToolListLocalCommand CreateCommandWithArg(string arg) { - var parseResult = Parser.Instance.Parse("dotnet tool list " + arg); + var parseResult = Parser.Parse("dotnet tool list " + arg); var command = new ToolListLocalCommand( parseResult, _toolManifestInspector, diff --git a/test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreCommandTests.cs index e91ae429f23a..c84b9c8ee372 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreCommandTests.cs @@ -67,7 +67,7 @@ public ToolRestoreCommandTests(ITestOutputHelper log): base(log) _toolPackageDownloaderMock = new ToolPackageDownloaderMock( _toolPackageStore, - _fileSystem, + _fileSystem, _reporter, new List { @@ -99,7 +99,7 @@ public ToolRestoreCommandTests(ITestOutputHelper log): base(log) }, downloadCallback: () => _installCalledCount++); - _parseResult = Parser.Instance.Parse("dotnet tool restore"); + _parseResult = Parser.Parse("dotnet tool restore"); _localToolsResolverCache = new LocalToolsResolverCache( diff --git a/test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreCommandWithMultipleNugetConfigTests.cs b/test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreCommandWithMultipleNugetConfigTests.cs index 4db59dbac6dc..631e6380531b 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreCommandWithMultipleNugetConfigTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreCommandWithMultipleNugetConfigTests.cs @@ -51,7 +51,7 @@ public ToolRestoreCommandWithMultipleNugetConfigTests() SetupFileLayoutAndFeed(temporaryDirectory, toolPackageStoreMock); - _parseResult = Parser.Instance.Parse("dotnet tool restore"); + _parseResult = Parser.Parse("dotnet tool restore"); _localToolsResolverCache = new LocalToolsResolverCache( diff --git a/test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreParserTests.cs b/test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreParserTests.cs index c9751c863531..baba2ba90b52 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreParserTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreParserTests.cs @@ -20,7 +20,7 @@ public ToolRestoreParserTests(ITestOutputHelper output) [Fact] public void ToolRestoreParserCanGetManifestFilePath() { - var result = Parser.Instance.Parse("dotnet tool restore --tool-manifest folder/my-manifest.format"); + var result = Parser.Parse("dotnet tool restore --tool-manifest folder/my-manifest.format"); result.GetRequiredValue(ToolRestoreCommandParser.ToolManifestOption).Should().Be("folder/my-manifest.format"); } @@ -29,7 +29,7 @@ public void ToolRestoreParserCanGetManifestFilePath() public void ToolRestoreParserCanGetFollowingArguments() { var result = - Parser.Instance.Parse( + Parser.Parse( @"dotnet tool restore --configfile C:\TestAssetLocalNugetFeed"); result.GetRequiredValue(ToolRestoreCommandParser.ConfigOption).Should().Be(@"C:\TestAssetLocalNugetFeed"); @@ -41,7 +41,7 @@ public void ToolRestoreParserCanParseSourceOption() const string expectedSourceValue = "TestSourceValue"; var result = - Parser.Instance.Parse($"dotnet tool restore --add-source {expectedSourceValue}"); + Parser.Parse($"dotnet tool restore --add-source {expectedSourceValue}"); result.GetRequiredValue(ToolRestoreCommandParser.AddSourceOption).First().Should().Be(expectedSourceValue); } @@ -53,7 +53,7 @@ public void ToolRestoreParserCanParseMultipleSourceOption() const string expectedSourceValue2 = "TestSourceValue2"; var result = - Parser.Instance.Parse( + Parser.Parse( $"dotnet tool restore " + $"--add-source {expectedSourceValue1} " + $"--add-source {expectedSourceValue2}"); @@ -67,7 +67,7 @@ public void ToolRestoreParserCanParseVerbosityOption() { const string expectedVerbosityLevel = "diag"; - var result = Parser.Instance.Parse($"dotnet tool restore --verbosity {expectedVerbosityLevel}"); + var result = Parser.Parse($"dotnet tool restore --verbosity {expectedVerbosityLevel}"); Enum.GetName(result.GetRequiredValue(ToolRestoreCommandParser.VerbosityOption)).Should().Be(expectedVerbosityLevel); } @@ -76,7 +76,7 @@ public void ToolRestoreParserCanParseVerbosityOption() public void ToolRestoreParserCanParseNoCacheOption() { var result = - Parser.Instance.Parse(@"dotnet tool restore --no-cache"); + Parser.Parse(@"dotnet tool restore --no-cache"); result.GetRequiredValue(ToolCommandRestorePassThroughOptions.NoCacheOption).Should().BeTrue(); } @@ -85,7 +85,7 @@ public void ToolRestoreParserCanParseNoCacheOption() public void ToolRestoreParserCanParseNoHttpCacheOption() { var result = - Parser.Instance.Parse(@"dotnet tool restore --no-http-cache"); + Parser.Parse(@"dotnet tool restore --no-http-cache"); result.GetRequiredValue(ToolCommandRestorePassThroughOptions.NoHttpCacheOption).Should().BeTrue(); } @@ -94,7 +94,7 @@ public void ToolRestoreParserCanParseNoHttpCacheOption() public void ToolRestoreParserCanParseIgnoreFailedSourcesOption() { var result = - Parser.Instance.Parse(@"dotnet tool restore --ignore-failed-sources"); + Parser.Parse(@"dotnet tool restore --ignore-failed-sources"); result.GetRequiredValue(ToolCommandRestorePassThroughOptions.IgnoreFailedSourcesOption).Should().BeTrue(); } @@ -103,7 +103,7 @@ public void ToolRestoreParserCanParseIgnoreFailedSourcesOption() public void ToolRestoreParserCanParseDisableParallelOption() { var result = - Parser.Instance.Parse(@"dotnet tool restore --disable-parallel"); + Parser.Parse(@"dotnet tool restore --disable-parallel"); result.GetRequiredValue(ToolCommandRestorePassThroughOptions.DisableParallelOption).Should().BeTrue(); } @@ -112,7 +112,7 @@ public void ToolRestoreParserCanParseDisableParallelOption() public void ToolRestoreParserCanParseInteractiveRestoreOption() { var result = - Parser.Instance.Parse(@"dotnet tool restore --interactive"); + Parser.Parse(@"dotnet tool restore --interactive"); result.GetRequiredValue(ToolCommandRestorePassThroughOptions.InteractiveRestoreOption).Should().BeTrue(); } diff --git a/test/dotnet.Tests/CommandTests/Tool/Run/ToolRunCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Run/ToolRunCommandTests.cs index 21ccc5a8b9b6..f122a680dc71 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Run/ToolRunCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Run/ToolRunCommandTests.cs @@ -26,7 +26,7 @@ public ToolRunCommandTests(ITestOutputHelper log) : base(log) [Fact] public void WhenRunWithRollForwardOptionItShouldIncludeRollForwardInNativeHost() { - var parseResult = Parser.Instance.Parse($"dotnet tool run dotnet-a --allow-roll-forward"); + var parseResult = Parser.Parse($"dotnet tool run dotnet-a --allow-roll-forward"); var toolRunCommand = new ToolRunCommand(parseResult); @@ -46,7 +46,7 @@ public void WhenRunWithRollForwardOptionItShouldIncludeRollForwardInNativeHost() [Fact] public void WhenRunWithoutRollForwardOptionItShouldNotIncludeRollForwardInNativeHost() { - var parseResult = Parser.Instance.Parse($"dotnet tool run dotnet-a"); + var parseResult = Parser.Parse($"dotnet tool run dotnet-a"); var toolRunCommand = new ToolRunCommand(parseResult); diff --git a/test/dotnet.Tests/CommandTests/Tool/Run/ToolRunParserTests.cs b/test/dotnet.Tests/CommandTests/Tool/Run/ToolRunParserTests.cs index 31e965713350..4d85d44d1954 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Run/ToolRunParserTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Run/ToolRunParserTests.cs @@ -19,7 +19,7 @@ public ToolRunParserTests(ITestOutputHelper output) [Fact] public void ListToolParserCanGetToolCommandNameArgument() { - var result = Parser.Instance.Parse("dotnet tool run dotnetsay"); + var result = Parser.Parse("dotnet tool run dotnetsay"); var packageId = result.GetValue(ToolRunCommandParser.CommandNameArgument); @@ -29,7 +29,7 @@ public void ListToolParserCanGetToolCommandNameArgument() [Fact] public void ListToolParserCanGetCommandsArgumentInUnmatchedTokens() { - var result = Parser.Instance.Parse("dotnet tool run dotnetsay hi"); + var result = Parser.Parse("dotnet tool run dotnetsay hi"); result.ShowHelpOrErrorIfAppropriate(); // Should not throw error } @@ -37,7 +37,7 @@ public void ListToolParserCanGetCommandsArgumentInUnmatchedTokens() [Fact] public void ListToolParserCanGetCommandsArgumentInUnparsedTokens() { - var result = Parser.Instance.Parse("dotnet tool run dotnetsay -- hi"); + var result = Parser.Parse("dotnet tool run dotnetsay -- hi"); result.Errors.Should().BeEmpty(); } @@ -45,7 +45,7 @@ public void ListToolParserCanGetCommandsArgumentInUnparsedTokens() [Fact] public void ListToolParserCanGetCommandsArgumentInUnparsedTokens2() { - var result = Parser.Instance.Parse("dotnet tool run dotnetsay hi1 -- hi2"); + var result = Parser.Parse("dotnet tool run dotnetsay hi1 -- hi2"); result.ShowHelpOrErrorIfAppropriate(); // Should not throw error } @@ -53,7 +53,7 @@ public void ListToolParserCanGetCommandsArgumentInUnparsedTokens2() [Fact] public void RootSubCommandIsToolCommand() { - var result = Parser.Instance.Parse("dotnetsay run -v arg"); + var result = Parser.Parse("dotnetsay run -v arg"); result.RootSubCommandResult().Should().Be("dotnetsay"); } } diff --git a/test/dotnet.Tests/CommandTests/Tool/Search/NugetSearchApiParameterTests.cs b/test/dotnet.Tests/CommandTests/Tool/Search/NugetSearchApiParameterTests.cs index 2e31402fae3e..fc0a15472c3c 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Search/NugetSearchApiParameterTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Search/NugetSearchApiParameterTests.cs @@ -12,7 +12,7 @@ public class NugetSearchApiParameterTests [Fact] public void ItShouldValidateSkipType() { - var result = Parser.Instance.Parse("dotnet tool search mytool --skip wrongtype"); + var result = Parser.Parse("dotnet tool search mytool --skip wrongtype"); Action a = () => new NugetSearchApiParameter(result); a.Should().Throw(); } @@ -20,7 +20,7 @@ public void ItShouldValidateSkipType() [Fact] public void ItShouldValidateTakeType() { - var result = Parser.Instance.Parse("dotnet tool search mytool --take wrongtype"); + var result = Parser.Parse("dotnet tool search mytool --take wrongtype"); Action a = () => new NugetSearchApiParameter(result); a.Should().Throw(); @@ -29,7 +29,7 @@ public void ItShouldValidateTakeType() [Fact] public void ItShouldNotThrowWhenInputIsValid() { - var parseResult = Parser.Instance.Parse("dotnet tool search mytool --detail --skip 3 --take 4 --prerelease"); + var parseResult = Parser.Parse("dotnet tool search mytool --detail --skip 3 --take 4 --prerelease"); var result = new NugetSearchApiParameter(parseResult); result.Prerelease.Should().Be(true); diff --git a/test/dotnet.Tests/CommandTests/Tool/Search/ToolSearchParserTests.cs b/test/dotnet.Tests/CommandTests/Tool/Search/ToolSearchParserTests.cs index a599b145634f..629d48354260 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Search/ToolSearchParserTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Search/ToolSearchParserTests.cs @@ -19,7 +19,7 @@ public ToolSearchParserTests(ITestOutputHelper output) [Fact] public void DotnetToolSearchShouldThrowWhenNoSearchTerm() { - var result = Parser.Instance.Parse("dotnet tool search"); + var result = Parser.Parse("dotnet tool search"); Action a = () => new ToolSearchCommand(result); a.Should().Throw(); } @@ -27,7 +27,7 @@ public void DotnetToolSearchShouldThrowWhenNoSearchTerm() [Fact] public void ListSearchParserCanGetArguments() { - var result = Parser.Instance.Parse("dotnet tool search mytool --detail --skip 3 --take 4 --prerelease"); + var result = Parser.Parse("dotnet tool search mytool --detail --skip 3 --take 4 --prerelease"); var packageId = result.GetValue(ToolSearchCommandParser.SearchTermArgument); diff --git a/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallCommandTests.cs index 8c0b6253a322..000c40c24231 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallCommandTests.cs @@ -24,7 +24,7 @@ public ToolUninstallCommandTests() [Fact] public void WhenRunWithBothGlobalAndToolPathShowErrorMessage() { - var result = Parser.Instance.Parse($"dotnet tool uninstall -g --tool-path /tmp/folder {PackageId}"); + var result = Parser.Parse($"dotnet tool uninstall -g --tool-path /tmp/folder {PackageId}"); var toolUninstallCommand = new ToolUninstallCommand(result); @@ -39,7 +39,7 @@ public void WhenRunWithBothGlobalAndToolPathShowErrorMessage() [Fact] public void WhenRunWithBothGlobalAndLocalShowErrorMessage() { - var result = Parser.Instance.Parse($"dotnet tool uninstall --local --tool-path /tmp/folder {PackageId}"); + var result = Parser.Parse($"dotnet tool uninstall --local --tool-path /tmp/folder {PackageId}"); var toolUninstallCommand = new ToolUninstallCommand(result); @@ -54,7 +54,7 @@ public void WhenRunWithBothGlobalAndLocalShowErrorMessage() [Fact] public void WhenRunWithGlobalAndToolManifestShowErrorMessage() { - var result = Parser.Instance.Parse($"dotnet tool uninstall -g --tool-manifest folder/my-manifest.format {PackageId}"); + var result = Parser.Parse($"dotnet tool uninstall -g --tool-manifest folder/my-manifest.format {PackageId}"); var toolUninstallCommand = new ToolUninstallCommand(result); @@ -67,7 +67,7 @@ public void WhenRunWithGlobalAndToolManifestShowErrorMessage() [Fact] public void WhenRunWithToolPathAndToolManifestShowErrorMessage() { - var result = Parser.Instance.Parse( + var result = Parser.Parse( $"dotnet tool uninstall --tool-path /tmp/folder --tool-manifest folder/my-manifest.format {PackageId}"); var toolUninstallCommand = new ToolUninstallCommand(result); diff --git a/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallGlobalOrToolPathCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallGlobalOrToolPathCommandTests.cs index 7bf8eed51e8c..b5c5c811c653 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallGlobalOrToolPathCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallGlobalOrToolPathCommandTests.cs @@ -124,7 +124,7 @@ public void GivenAPackageWhenCallFromUninstallRedirectCommandItUninstalls() _reporter.Lines.Clear(); - ParseResult result = Parser.Instance.Parse("dotnet tool uninstall " + $"-g {PackageId}"); + ParseResult result = Parser.Parse("dotnet tool uninstall " + $"-g {PackageId}"); (IToolPackageStore, IToolPackageStoreQuery, IToolPackageUninstaller) CreateToolPackageStoreAndUninstaller( DirectoryPath? directoryPath) @@ -227,7 +227,7 @@ public void GivenAnInvalidToolPathItThrowsException() private ToolInstallGlobalOrToolPathCommand CreateInstallCommand(string options) { - ParseResult result = Parser.Instance.Parse("dotnet tool install " + options); + ParseResult result = Parser.Parse("dotnet tool install " + options); var store = new ToolPackageStoreMock(new DirectoryPath(_toolsDirectory), _fileSystem); @@ -255,7 +255,7 @@ private ToolInstallGlobalOrToolPathCommand CreateInstallCommand(string options) private ToolUninstallGlobalOrToolPathCommand CreateUninstallCommand(string options, Action uninstallCallback = null) { - ParseResult result = Parser.Instance.Parse("dotnet tool uninstall " + options); + ParseResult result = Parser.Parse("dotnet tool uninstall " + options); (IToolPackageStore, IToolPackageStoreQuery, IToolPackageUninstaller) createToolPackageStoreAndUninstaller( DirectoryPath? directoryPath) diff --git a/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallLocalCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallLocalCommandTests.cs index af64ca26af88..9210481f7934 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallLocalCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallLocalCommandTests.cs @@ -41,7 +41,7 @@ public ToolUninstallLocalCommandTests() _toolManifestFinder = new ToolManifestFinder(new DirectoryPath(_temporaryDirectory), _fileSystem, new FakeDangerousFileDetector()); _toolManifestEditor = new ToolManifestEditor(_fileSystem, new FakeDangerousFileDetector()); - _parseResult = Parser.Instance.Parse($"dotnet tool uninstall {_packageIdDotnsay.ToString()}"); + _parseResult = Parser.Parse($"dotnet tool uninstall {_packageIdDotnsay.ToString()}"); _defaultToolUninstallLocalCommand = new ToolUninstallLocalCommand( _parseResult, _toolManifestFinder, @@ -94,7 +94,7 @@ public void WhenRunWithExplicitManifestFileItShouldRemoveFromExplicitManifestFil _fileSystem.File.WriteAllText(explicitManifestFilePath, _jsonContent); var parseResult - = Parser.Instance.Parse( + = Parser.Parse( $"dotnet tool uninstall {_packageIdDotnsay.ToString()} --tool-manifest {explicitManifestFilePath}"); var toolUninstallLocalCommand = new ToolUninstallLocalCommand( parseResult, @@ -109,7 +109,7 @@ var parseResult [Fact] public void WhenRunFromToolUninstallRedirectCommandWithPackageIdItShouldRemoveFromManifestFile() { - var parseResult = Parser.Instance.Parse($"dotnet tool uninstall {_packageIdDotnsay.ToString()}"); + var parseResult = Parser.Parse($"dotnet tool uninstall {_packageIdDotnsay.ToString()}"); var toolUninstallLocalCommand = new ToolUninstallLocalCommand( parseResult, _toolManifestFinder, diff --git a/test/dotnet.Tests/CommandTests/Tool/Uninstall/UninstallToolParserTests.cs b/test/dotnet.Tests/CommandTests/Tool/Uninstall/UninstallToolParserTests.cs index 7ac17e7ea1fd..36a8432bf7d2 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Uninstall/UninstallToolParserTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Uninstall/UninstallToolParserTests.cs @@ -18,7 +18,7 @@ public UninstallToolParserTests(ITestOutputHelper output) [Fact] public void UninstallToolParserCanGetPackageId() { - var result = Parser.Instance.Parse("dotnet tool uninstall -g console.test.app"); + var result = Parser.Parse("dotnet tool uninstall -g console.test.app"); var packageId = result.GetValue(ToolUninstallCommandParser.PackageIdArgument); @@ -28,7 +28,7 @@ public void UninstallToolParserCanGetPackageId() [Fact] public void UninstallToolParserCanGetGlobalOption() { - var result = Parser.Instance.Parse("dotnet tool uninstall -g console.test.app"); + var result = Parser.Parse("dotnet tool uninstall -g console.test.app"); result.GetValue(ToolUninstallCommandParser.GlobalOption).Should().Be(true); } @@ -37,7 +37,7 @@ public void UninstallToolParserCanGetGlobalOption() public void UninstallToolParserCanParseToolPathOption() { var result = - Parser.Instance.Parse(@"dotnet tool uninstall --tool-path C:\Tools console.test.app"); + Parser.Parse(@"dotnet tool uninstall --tool-path C:\Tools console.test.app"); result.GetValue(ToolUninstallCommandParser.ToolPathOption).Should().Be(@"C:\Tools"); } @@ -46,7 +46,7 @@ public void UninstallToolParserCanParseToolPathOption() public void UninstallToolParserCanParseLocalOption() { var result = - Parser.Instance.Parse(@"dotnet tool uninstall --local console.test.app"); + Parser.Parse(@"dotnet tool uninstall --local console.test.app"); result.GetValue(ToolUninstallCommandParser.LocalOption).Should().Be(true); } @@ -55,7 +55,7 @@ public void UninstallToolParserCanParseLocalOption() public void UninstallToolParserCanParseToolManifestOption() { var result = - Parser.Instance.Parse(@"dotnet tool uninstall --tool-manifest folder/my-manifest.format console.test.app"); + Parser.Parse(@"dotnet tool uninstall --tool-manifest folder/my-manifest.format console.test.app"); result.GetValue(ToolUninstallCommandParser.ToolManifestOption).Should().Be(@"folder/my-manifest.format"); } diff --git a/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateCommandTests.cs index 85acd63bde6c..d2d692c30b46 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateCommandTests.cs @@ -22,7 +22,7 @@ public ToolUpdateCommandTests() [Fact] public void WhenRunWithBothGlobalAndToolPathShowErrorMessage() { - var result = Parser.Instance.Parse($"dotnet tool update -g --tool-path /tmp/folder {PackageId}"); + var result = Parser.Parse($"dotnet tool update -g --tool-path /tmp/folder {PackageId}"); var toolUpdateCommand = new ToolUpdateCommand( result); @@ -38,7 +38,7 @@ public void WhenRunWithBothGlobalAndToolPathShowErrorMessage() [Fact] public void WhenRunWithBothGlobalAndLocalShowErrorMessage() { - var result = Parser.Instance.Parse($"dotnet tool update --local --tool-path /tmp/folder {PackageId}"); + var result = Parser.Parse($"dotnet tool update --local --tool-path /tmp/folder {PackageId}"); var toolUpdateCommand = new ToolUpdateCommand( result); @@ -55,7 +55,7 @@ public void WhenRunWithBothGlobalAndLocalShowErrorMessage() public void WhenRunWithGlobalAndToolManifestShowErrorMessage() { var result = - Parser.Instance.Parse($"dotnet tool update -g --tool-manifest folder/my-manifest.format {PackageId}"); + Parser.Parse($"dotnet tool update -g --tool-manifest folder/my-manifest.format {PackageId}"); var toolUpdateCommand = new ToolUpdateCommand( result); @@ -70,7 +70,7 @@ public void WhenRunWithGlobalAndToolManifestShowErrorMessage() public void WhenRunWithToolPathAndToolManifestShowErrorMessage() { var result = - Parser.Instance.Parse( + Parser.Parse( $"dotnet tool update --tool-path /tmp/folder --tool-manifest folder/my-manifest.format {PackageId}"); var toolUpdateCommand = new ToolUpdateCommand( @@ -86,7 +86,7 @@ public void WhenRunWithToolPathAndToolManifestShowErrorMessage() public void WhenRunWithAllAndVersionShowErrorMessage() { var result = - Parser.Instance.Parse( + Parser.Parse( $"dotnet tool update --all --version 1.0.0"); var toolUpdateCommand = new ToolUpdateCommand( @@ -104,7 +104,7 @@ public void WhenRunWithAllAndVersionShowErrorMessage() [Fact] public void WhenRunWithoutAllOrPackageIdShowErrorMessage() { - var result = Parser.Instance.Parse($"dotnet tool update"); + var result = Parser.Parse($"dotnet tool update"); var toolUpdateCommand = new ToolUpdateCommand(result); @@ -119,7 +119,7 @@ public void WhenRunWithoutAllOrPackageIdShowErrorMessage() [Fact] public void WhenRunWithBothAllAndPackageIdShowErrorMessage() { - var result = Parser.Instance.Parse($"dotnet tool update packageId --all"); + var result = Parser.Parse($"dotnet tool update packageId --all"); var toolUpdateCommand = new ToolUpdateCommand(result); diff --git a/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateGlobalOrToolPathCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateGlobalOrToolPathCommandTests.cs index cab679766e46..846a2c423d9a 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateGlobalOrToolPathCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateGlobalOrToolPathCommandTests.cs @@ -106,7 +106,7 @@ public ToolUpdateGlobalOrToolPathCommandTests(ITestOutputHelper log) : base(log) [Fact] public void WhenPassingRestoreActionConfigOptions() { - var parseResult = Parser.Instance.Parse($"dotnet tool update -g {_packageId} --ignore-failed-sources"); + var parseResult = Parser.Parse($"dotnet tool update -g {_packageId} --ignore-failed-sources"); var toolUpdateCommand = new ToolUpdateGlobalOrToolPathCommand(parseResult); toolUpdateCommand._toolInstallGlobalOrToolPathCommand.restoreActionConfig.IgnoreFailedSources.Should().BeTrue(); } @@ -179,7 +179,7 @@ public void GivenAnExistedLowerversionInstallationWhenCallFromRedirectorItCanUpd { CreateInstallCommand($"-g {_packageId} --version {LowerPackageVersion}").Execute(); - ParseResult result = Parser.Instance.Parse("dotnet tool update " + $"-g {_packageId}"); + ParseResult result = Parser.Parse("dotnet tool update " + $"-g {_packageId}"); var toolUpdateGlobalOrToolPathCommand = new ToolUpdateGlobalOrToolPathCommand( result, @@ -360,7 +360,7 @@ public void GivenAnExistedLowerversionWhenReinstallThrowsIthasTheFirstLineIndica CreateInstallCommand($"-g {_packageId} --version {LowerPackageVersion}").Execute(); _reporter.Lines.Clear(); - ParseResult result = Parser.Instance.Parse("dotnet tool update " + $"-g {_packageId}"); + ParseResult result = Parser.Parse("dotnet tool update " + $"-g {_packageId}"); var command = new ToolUpdateGlobalOrToolPathCommand( result, @@ -387,7 +387,7 @@ public void GivenAnExistedLowerversionWhenReinstallThrowsItRollsBack() CreateInstallCommand($"-g {_packageId} --version {LowerPackageVersion}").Execute(); _reporter.Lines.Clear(); - ParseResult result = Parser.Instance.Parse("dotnet tool update " + $"-g {_packageId}"); + ParseResult result = Parser.Parse("dotnet tool update " + $"-g {_packageId}"); var command = new ToolUpdateGlobalOrToolPathCommand( result, @@ -425,7 +425,7 @@ public void GivenPackagedShimIsProvidedWhenRunWithPackageIdItCreatesShimUsingPac _reporter.Lines.Clear(); string options = $"-g {_packageId}"; - ParseResult result = Parser.Instance.Parse("dotnet tool update " + options); + ParseResult result = Parser.Parse("dotnet tool update " + options); var command = new ToolUpdateGlobalOrToolPathCommand( result, @@ -439,7 +439,7 @@ public void GivenPackagedShimIsProvidedWhenRunWithPackageIdItCreatesShimUsingPac string ExpectedCommandPath() { - + return Path.Combine( _shimsDirectory, "SimulatorCommand" + extension); @@ -448,7 +448,7 @@ string ExpectedCommandPath() private ToolInstallGlobalOrToolPathCommand CreateInstallCommand(string options, string packageId = null) { - ParseResult result = Parser.Instance.Parse("dotnet tool install " + options); + ParseResult result = Parser.Parse("dotnet tool install " + options); return new ToolInstallGlobalOrToolPathCommand( result, @@ -461,7 +461,7 @@ private ToolInstallGlobalOrToolPathCommand CreateInstallCommand(string options, private ToolUpdateGlobalOrToolPathCommand CreateUpdateCommand(string options) { - ParseResult result = Parser.Instance.Parse("dotnet tool update " + options); + ParseResult result = Parser.Parse("dotnet tool update " + options); return new ToolUpdateGlobalOrToolPathCommand( result, diff --git a/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateLocalCommandTests.cs b/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateLocalCommandTests.cs index 2edee6f822c6..a23199972666 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateLocalCommandTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateLocalCommandTests.cs @@ -86,7 +86,7 @@ public ToolUpdateLocalCommandTests() _toolPackageDownloaderMock = new ToolPackageDownloaderMock( store: _toolPackageStore, fileSystem: _fileSystem, - reporter: _reporter, + reporter: _reporter, new List { _mockFeed @@ -104,8 +104,8 @@ public ToolUpdateLocalCommandTests() new FakeDangerousFileDetector()); _toolManifestEditor = new ToolManifestEditor(_fileSystem, new FakeDangerousFileDetector()); - _parseResult = Parser.Instance.Parse($"dotnet tool update {_packageIdA.ToString()}"); - _parseResultUpdateAll = Parser.Instance.Parse($"dotnet tool update --all --local"); + _parseResult = Parser.Parse($"dotnet tool update {_packageIdA.ToString()}"); + _parseResultUpdateAll = Parser.Parse($"dotnet tool update --all --local"); _toolRestoreCommand = new ToolRestoreCommand( _parseResult, @@ -136,7 +136,7 @@ public ToolUpdateLocalCommandTests() [Fact] public void WhenPassingRestoreActionConfigOptions() { - var parseResult = Parser.Instance.Parse($"dotnet tool update {_packageIdA.ToString()} --ignore-failed-sources"); + var parseResult = Parser.Parse($"dotnet tool update {_packageIdA.ToString()} --ignore-failed-sources"); var command = new ToolUpdateLocalCommand(parseResult); command._toolInstallLocalCommand.Value.restoreActionConfig.IgnoreFailedSources.Should().BeTrue(); } @@ -145,7 +145,7 @@ public void WhenPassingRestoreActionConfigOptions() public void WhenPassingIgnoreFailedSourcesItShouldNotThrow() { _fileSystem.File.WriteAllText(Path.Combine(_temporaryDirectory, "nuget.config"), _nugetConfigWithInvalidSources); - var parseResult = Parser.Instance.Parse($"dotnet tool update {_packageIdA.ToString()} --ignore-failed-sources"); + var parseResult = Parser.Parse($"dotnet tool update {_packageIdA.ToString()} --ignore-failed-sources"); var updateLocalCommand = new ToolUpdateLocalCommand( parseResult, _toolPackageDownloaderMock, @@ -175,7 +175,7 @@ public void WhenRunWithUpdateAllItShouldUpdateFromManifestFile() { _toolRestoreCommand.Execute(); new ToolRestoreCommand( - Parser.Instance.Parse($"dotnet tool restore"), + Parser.Parse($"dotnet tool restore"), _toolPackageDownloaderMock, _toolManifestFinder, _localToolsResolverCache, @@ -250,7 +250,7 @@ public void WhenRunWithExplicitManifestFileItShouldUpdateFromExplicitManifestFil _fileSystem.File.WriteAllText(explicitManifestFilePath, _jsonContent); ParseResult parseResult - = Parser.Instance.Parse( + = Parser.Parse( $"dotnet tool update {_packageIdA.ToString()} --tool-manifest {explicitManifestFilePath}"); _toolRestoreCommand.Execute(); @@ -271,7 +271,7 @@ ParseResult parseResult [Fact] public void WhenRunFromToolUpdateRedirectCommandWithPackageIdItShouldUpdateFromManifestFile() { - ParseResult parseResult = Parser.Instance.Parse($"dotnet tool update {_packageIdA.ToString()}"); + ParseResult parseResult = Parser.Parse($"dotnet tool update {_packageIdA.ToString()}"); _toolRestoreCommand.Execute(); _mockFeed.Packages[0].Version = _packageNewVersionA.ToNormalizedString(); @@ -382,7 +382,7 @@ public void GivenFeedVersionIsLowerWithDowngradeFlagRunPackageIdItShouldSucceeds _reporter.Clear(); ParseResult parseResult - = Parser.Instance.Parse( + = Parser.Parse( $"dotnet tool update {_packageIdA.ToString()} --version 0.9.0 --allow-downgrade"); _toolRestoreCommand.Execute(); diff --git a/test/dotnet.Tests/CommandTests/Tool/Update/UpdateToolParserTests.cs b/test/dotnet.Tests/CommandTests/Tool/Update/UpdateToolParserTests.cs index b63f16031cb1..7266cb443f31 100644 --- a/test/dotnet.Tests/CommandTests/Tool/Update/UpdateToolParserTests.cs +++ b/test/dotnet.Tests/CommandTests/Tool/Update/UpdateToolParserTests.cs @@ -25,7 +25,7 @@ public UpdateInstallToolParserTests(ITestOutputHelper output) [InlineData("console.test.app@1.*", "1.*")] public void UpdateGlobalToolParserCanGetPackageIdentityWithVersion(string arguments, string expectedVersion) { - var result = Parser.Instance.Parse($"dotnet tool update -g {arguments}"); + var result = Parser.Parse($"dotnet tool update -g {arguments}"); var packageIdentity = result.GetValue(ToolUpdateCommandParser.PackageIdentityArgument); var packageId = packageIdentity?.Id; var packageVersion = packageIdentity?.VersionRange?.OriginalString ?? result.GetValue(ToolInstallCommandParser.VersionOption); @@ -37,7 +37,7 @@ public void UpdateGlobalToolParserCanGetPackageIdentityWithVersion(string argume [Fact] public void UpdateGlobaltoolParserCanGetPackageId() { - var result = Parser.Instance.Parse("dotnet tool update -g console.test.app"); + var result = Parser.Parse("dotnet tool update -g console.test.app"); var packageId = result.GetValue(ToolUpdateCommandParser.PackageIdentityArgument)?.Id; @@ -47,7 +47,7 @@ public void UpdateGlobaltoolParserCanGetPackageId() [Fact] public void UpdateToolParserCanGetGlobalOption() { - var result = Parser.Instance.Parse("dotnet tool update -g console.test.app"); + var result = Parser.Parse("dotnet tool update -g console.test.app"); result.GetValue(ToolInstallCommandParser.GlobalOption).Should().Be(true); } @@ -56,7 +56,7 @@ public void UpdateToolParserCanGetGlobalOption() public void UpdateToolParserCanGetFollowingArguments() { var result = - Parser.Instance.Parse( + Parser.Parse( $@"dotnet tool update -g console.test.app --version 1.0.1 --framework {ToolsetInfo.CurrentTargetFramework} --configfile C:\TestAssetLocalNugetFeed"); result.GetValue(ToolInstallCommandParser.ConfigOption).Should().Be(@"C:\TestAssetLocalNugetFeed"); @@ -69,7 +69,7 @@ public void UpdateToolParserCanParseSourceOption() const string expectedSourceValue = "TestSourceValue"; var result = - Parser.Instance.Parse($"dotnet tool update -g --add-source {expectedSourceValue} console.test.app"); + Parser.Parse($"dotnet tool update -g --add-source {expectedSourceValue} console.test.app"); result.GetRequiredValue(ToolInstallCommandParser.AddSourceOption).First().Should().Be(expectedSourceValue); } @@ -81,7 +81,7 @@ public void UpdateToolParserCanParseMultipleSourceOption() const string expectedSourceValue2 = "TestSourceValue2"; var result = - Parser.Instance.Parse( + Parser.Parse( $"dotnet tool update -g " + $"--add-source {expectedSourceValue1} " + $"--add-source {expectedSourceValue2} console.test.app"); @@ -95,7 +95,7 @@ public void UpdateToolParserCanParseVerbosityOption() const string expectedVerbosityLevel = "diag"; var result = - Parser.Instance.Parse($"dotnet tool update -g --verbosity:{expectedVerbosityLevel} console.test.app"); + Parser.Parse($"dotnet tool update -g --verbosity:{expectedVerbosityLevel} console.test.app"); Enum.GetName(result.GetValue(ToolInstallCommandParser.VerbosityOption)).Should().Be(expectedVerbosityLevel); } @@ -104,7 +104,7 @@ public void UpdateToolParserCanParseVerbosityOption() public void UpdateToolParserCanParseToolPathOption() { var result = - Parser.Instance.Parse(@"dotnet tool update --tool-path C:\TestAssetLocalNugetFeed console.test.app"); + Parser.Parse(@"dotnet tool update --tool-path C:\TestAssetLocalNugetFeed console.test.app"); result.GetValue(ToolInstallCommandParser.ToolPathOption).Should().Be(@"C:\TestAssetLocalNugetFeed"); } @@ -113,7 +113,7 @@ public void UpdateToolParserCanParseToolPathOption() public void UpdateToolParserCanParseNoCacheOption() { var result = - Parser.Instance.Parse(@"dotnet tool update -g console.test.app --no-cache"); + Parser.Parse(@"dotnet tool update -g console.test.app --no-cache"); result.GetValue(ToolCommandRestorePassThroughOptions.NoCacheOption).Should().Be(true); } @@ -122,7 +122,7 @@ public void UpdateToolParserCanParseNoCacheOption() public void UpdateToolParserCanParseNoHttpCacheOption() { var result = - Parser.Instance.Parse(@"dotnet tool update -g console.test.app --no-http-cache"); + Parser.Parse(@"dotnet tool update -g console.test.app --no-http-cache"); result.GetValue(ToolCommandRestorePassThroughOptions.NoHttpCacheOption).Should().Be(true); } @@ -131,7 +131,7 @@ public void UpdateToolParserCanParseNoHttpCacheOption() public void UpdateToolParserCanParseIgnoreFailedSourcesOption() { var result = - Parser.Instance.Parse(@"dotnet tool update -g console.test.app --ignore-failed-sources"); + Parser.Parse(@"dotnet tool update -g console.test.app --ignore-failed-sources"); result.GetValue(ToolCommandRestorePassThroughOptions.IgnoreFailedSourcesOption).Should().Be(true); } @@ -140,7 +140,7 @@ public void UpdateToolParserCanParseIgnoreFailedSourcesOption() public void UpdateToolParserCanParseDisableParallelOption() { var result = - Parser.Instance.Parse(@"dotnet tool update -g console.test.app --disable-parallel"); + Parser.Parse(@"dotnet tool update -g console.test.app --disable-parallel"); result.GetValue(ToolCommandRestorePassThroughOptions.DisableParallelOption).Should().Be(true); } @@ -149,7 +149,7 @@ public void UpdateToolParserCanParseDisableParallelOption() public void UpdateToolParserCanParseInteractiveRestoreOption() { var result = - Parser.Instance.Parse(@"dotnet tool update -g console.test.app --interactive"); + Parser.Parse(@"dotnet tool update -g console.test.app --interactive"); result.GetValue(ToolCommandRestorePassThroughOptions.InteractiveRestoreOption).Should().Be(true); } @@ -157,7 +157,7 @@ public void UpdateToolParserCanParseInteractiveRestoreOption() public void UpdateToolParserCanParseVersionOption() { var result = - Parser.Instance.Parse(@"dotnet tool update -g console.test.app --version 1.2"); + Parser.Parse(@"dotnet tool update -g console.test.app --version 1.2"); result.GetValue(ToolInstallCommandParser.VersionOption).Should().Be("1.2"); } @@ -166,7 +166,7 @@ public void UpdateToolParserCanParseVersionOption() public void UpdateToolParserCanParseLocalOption() { var result = - Parser.Instance.Parse(@"dotnet tool update --local console.test.app"); + Parser.Parse(@"dotnet tool update --local console.test.app"); result.GetValue(ToolInstallCommandParser.LocalOption).Should().Be(true); } @@ -175,7 +175,7 @@ public void UpdateToolParserCanParseLocalOption() public void UpdateToolParserCanParseToolManifestOption() { var result = - Parser.Instance.Parse(@"dotnet tool update --tool-manifest folder/my-manifest.format console.test.app"); + Parser.Parse(@"dotnet tool update --tool-manifest folder/my-manifest.format console.test.app"); result.GetValue(ToolInstallCommandParser.ToolManifestOption).Should().Be(@"folder/my-manifest.format"); } diff --git a/test/dotnet.Tests/CommandTests/Workload/Clean/GivenDotnetWorkloadClean.cs b/test/dotnet.Tests/CommandTests/Workload/Clean/GivenDotnetWorkloadClean.cs index f79f293c0f24..73576f45f9dd 100644 --- a/test/dotnet.Tests/CommandTests/Workload/Clean/GivenDotnetWorkloadClean.cs +++ b/test/dotnet.Tests/CommandTests/Workload/Clean/GivenDotnetWorkloadClean.cs @@ -113,7 +113,7 @@ private void InstallWorkload(string userProfileDir, string dotnetRoot, string te { sdkBand ??= _sdkFeatureVersion; - var installParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", _installingWorkload }); + var installParseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", _installingWorkload }); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetRoot, sdkBand, workloadResolver, userProfileDir); var installCommand = new WorkloadInstallCommand(installParseResult, reporter: _reporter, workloadResolverFactory: workloadResolverFactory, nugetPackageDownloader: nugetDownloader, workloadManifestUpdater: _manifestUpdater, tempDirPath: testDirectory); @@ -123,7 +123,7 @@ private void InstallWorkload(string userProfileDir, string dotnetRoot, string te private WorkloadCleanCommand GenerateWorkloadCleanCommand(WorkloadResolver workloadResolver, string userProfileDir, string dotnetRoot) { - var cleanParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "clean" }); + var cleanParseResult = Parser.Parse(new string[] { "dotnet", "workload", "clean" }); return MakeWorkloadCleanCommand(cleanParseResult, workloadResolver, userProfileDir, dotnetRoot); } @@ -135,7 +135,7 @@ private WorkloadCleanCommand MakeWorkloadCleanCommand(ParseResult parseResult, W private WorkloadCleanCommand GenerateWorkloadCleanAllCommand(WorkloadResolver workloadResolver, string userProfileDir, string dotnetRoot) { - var cleanParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "clean", "--all" }); + var cleanParseResult = Parser.Parse(new string[] { "dotnet", "workload", "clean", "--all" }); return MakeWorkloadCleanCommand(cleanParseResult, workloadResolver, userProfileDir, dotnetRoot); } diff --git a/test/dotnet.Tests/CommandTests/Workload/Install/GivenDotnetWorkloadInstall.cs b/test/dotnet.Tests/CommandTests/Workload/Install/GivenDotnetWorkloadInstall.cs index 038cb5481b8a..316337d5712a 100644 --- a/test/dotnet.Tests/CommandTests/Workload/Install/GivenDotnetWorkloadInstall.cs +++ b/test/dotnet.Tests/CommandTests/Workload/Install/GivenDotnetWorkloadInstall.cs @@ -66,7 +66,7 @@ public void ItErrorUsingSkipManifestAndRollback() public void GivenWorkloadInstallItCanInstallPacks(bool userLocal, string sdkVersion) { var mockWorkloadIds = new WorkloadId[] { new WorkloadId("xamarin-android") }; - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "--skip-manifest-update" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "--skip-manifest-update" }); (_, var installManager, var installer, _, _, _, _) = GetTestInstallers(parseResult, userLocal, sdkVersion, installedFeatureBand: sdkVersion); installManager.Execute() @@ -87,7 +87,7 @@ public void GivenWorkloadInstallItCanInstallPacks(bool userLocal, string sdkVers public void GivenWorkloadInstallItCanRollBackPackInstallation(bool userLocal, string sdkVersion) { var mockWorkloadIds = new WorkloadId[] { new WorkloadId("xamarin-android"), new WorkloadId("xamarin-android-build") }; - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "xamarin-android-build", "--skip-manifest-update" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "xamarin-android-build", "--skip-manifest-update" }); (_, var installManager, var installer, var workloadResolver, _, _, _) = GetTestInstallers(parseResult, userLocal, sdkVersion, failingWorkload: "xamarin-android-build", installedFeatureBand: sdkVersion); var exceptionThrown = Assert.Throws(() => installManager.Execute()); @@ -110,7 +110,7 @@ public void GivenWorkloadInstallOnFailingRollbackItDisplaysTopLevelError() var dotnetRoot = Path.Combine(testDirectory, "dotnet"); var installer = new MockPackWorkloadInstaller(failingWorkload: "xamarin-android-build", failingRollback: true); var workloadResolver = WorkloadResolver.CreateForTests(new MockManifestProvider(new[] { _manifestPath }), dotnetRoot); - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "xamarin-android-build", "--skip-manifest-update" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "xamarin-android-build", "--skip-manifest-update" }); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetRoot, "6.0.100", workloadResolver); var installManager = new WorkloadInstallCommand(parseResult, reporter: _reporter, workloadResolverFactory, workloadInstaller: installer); @@ -127,10 +127,10 @@ public void GivenWorkloadInstallOnFailingRollbackItDisplaysTopLevelError() [InlineData(false, "6.0.100")] public void GivenWorkloadInstallItCanUpdateAdvertisingManifests(bool userLocal, string sdkVersion) { - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android" }); (_, var installManager, var installer, _, var manifestUpdater, _, var resolverFactory) = GetTestInstallers(parseResult, userLocal, sdkVersion, installedFeatureBand: sdkVersion); - new WorkloadConfigCommand(Parser.Instance.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), workloadResolverFactory: resolverFactory).Execute().Should().Be(0); + new WorkloadConfigCommand(Parser.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), workloadResolverFactory: resolverFactory).Execute().Should().Be(0); installManager.Execute() .Should().Be(0); @@ -148,7 +148,7 @@ public void GivenWorkloadInstallItWarnsOnGarbageCollectionFailure() var dotnetRoot = Path.Combine(testDirectory, "dotnet"); var installer = new MockPackWorkloadInstaller(failingGarbageCollection: true); var workloadResolver = WorkloadResolver.CreateForTests(new MockManifestProvider(new[] { _manifestPath }), dotnetRoot); - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "xamarin-android-build", "--skip-manifest-update" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "xamarin-android-build", "--skip-manifest-update" }); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetRoot, "6.0.100", workloadResolver); var installManager = new WorkloadInstallCommand(parseResult, reporter: _reporter, workloadResolverFactory, workloadInstaller: installer); @@ -174,13 +174,13 @@ public void GivenInfoOptionWorkloadBaseCommandAcceptsThatOption() public void GivenNoWorkloadsInstalledInfoOptionRemarksOnThat() { // We can't easily mock the end to end process of installing a workload and testing --info on it so we are adding that to the manual testing document. - // However, we can test a setup where no workloads are installed and --info is provided. + // However, we can test a setup where no workloads are installed and --info is provided. _reporter.Clear(); var testDirectory = _testAssetsManager.CreateTestDirectory().Path; var dotnetRoot = Path.Combine(testDirectory, "dotnet"); var workloadResolver = WorkloadResolver.CreateForTests(new MockManifestProvider(new[] { _manifestPath }), dotnetRoot); - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android" }); WorkloadInfoHelper workloadInfoHelper = new WorkloadInfoHelper(isInteractive: false, workloadResolver: workloadResolver); WorkloadCommandParser.ShowWorkloadsInfo(parseResult, workloadInfoHelper: workloadInfoHelper, reporter: _reporter); @@ -199,7 +199,7 @@ public void GivenBadOptionWorkloadBaseInformsRequiredCommandWasNotProvided() .Should() .Fail() .And - .HaveStdErrContaining("Required command was not provided."); + .HaveStdErrContaining("'--infoz'"); // we should complain about the bad option not being recognized } [Theory] @@ -210,7 +210,7 @@ public void GivenBadOptionWorkloadBaseInformsRequiredCommandWasNotProvided() public void GivenWorkloadInstallItCanUpdateInstalledManifests(bool userLocal, string sdkVersion) { var parseResult = - Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android" }); + Parser.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android" }); var featureBand = new SdkFeatureBand(sdkVersion); var manifestsToUpdate = new ManifestUpdateWithWorkloads[] @@ -220,7 +220,7 @@ public void GivenWorkloadInstallItCanUpdateInstalledManifests(bool userLocal, st (_, var installManager, var installer, _, _, _, var resolverFactory) = GetTestInstallers(parseResult, userLocal, sdkVersion, manifestUpdates: manifestsToUpdate, installedFeatureBand: sdkVersion); - new WorkloadConfigCommand(Parser.Instance.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), workloadResolverFactory: resolverFactory).Execute().Should().Be(0); + new WorkloadConfigCommand(Parser.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), workloadResolverFactory: resolverFactory).Execute().Should().Be(0); installManager.Execute() .Should().Be(0); @@ -245,14 +245,14 @@ public void GivenWorkloadInstallFromCacheItInstallsCachedManifest(bool userLocal }; var cachePath = Path.Combine(_testAssetsManager.CreateTestDirectory(identifier: AppendForUserLocal("mockCache_", userLocal) + sdkVersion).Path, "mockCachePath"); - var parseResult = Parser.Instance.Parse(new string[] + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "--from-cache", cachePath }); (_, var installManager, var installer, _, _, _, var resolverFactory) = GetTestInstallers(parseResult, userLocal, sdkVersion, tempDirManifestPath: _manifestPath, manifestUpdates: manifestsToUpdate, installedFeatureBand: sdkVersion); - new WorkloadConfigCommand(Parser.Instance.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), workloadResolverFactory: resolverFactory).Execute().Should().Be(0); + new WorkloadConfigCommand(Parser.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), workloadResolverFactory: resolverFactory).Execute().Should().Be(0); installManager.Execute(); installer.InstalledManifests[0].manifestUpdate.ManifestId.Should().Be(manifestsToUpdate[0].ManifestUpdate.ManifestId); @@ -269,7 +269,7 @@ public void GivenWorkloadInstallFromCacheItInstallsCachedManifest(bool userLocal public void GivenWorkloadInstallItCanDownloadToOfflineCache(bool userLocal, string sdkVersion) { var cachePath = Path.Combine(_testAssetsManager.CreateTestDirectory(identifier: AppendForUserLocal("mockCache_", userLocal) + sdkVersion).Path, "mockCachePath"); - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "--download-to-cache", cachePath }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "--download-to-cache", cachePath }); (_, var installManager, _, _, var manifestUpdater, var packageDownloader, _) = GetTestInstallers(parseResult, userLocal, sdkVersion, tempDirManifestPath: _manifestPath, installedFeatureBand: sdkVersion); installManager.Execute(); @@ -293,7 +293,7 @@ public void GivenWorkloadInstallItCanInstallFromOfflineCache(bool userLocal, str { var mockWorkloadIds = new WorkloadId[] { new WorkloadId("xamarin-android") }; var cachePath = "mockCachePath"; - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "--from-cache", cachePath }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "--from-cache", cachePath }); (_, var installManager, var installer, _, _, var nugetDownloader, _) = GetTestInstallers(parseResult, userLocal, sdkVersion, installedFeatureBand: sdkVersion); installManager.Execute(); @@ -313,7 +313,7 @@ public void GivenWorkloadInstallItCanInstallFromOfflineCache(bool userLocal, str [InlineData(false, "6.0.100")] public void GivenWorkloadInstallItPrintsDownloadUrls(bool userLocal, string sdkVersion) { - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "--print-download-link-only" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", "xamarin-android", "--print-download-link-only" }); (_, var installManager, _, _, _, _, _) = GetTestInstallers(parseResult, userLocal, sdkVersion, tempDirManifestPath: _manifestPath, installedFeatureBand: sdkVersion); installManager.Execute(); @@ -333,7 +333,7 @@ public void GivenWorkloadInstallItErrorsOnUnsupportedPlatform() var workloadResolver = WorkloadResolver.CreateForTests(new MockManifestProvider(new[] { manifestPath }), dotnetRoot); var nugetDownloader = new MockNuGetPackageDownloader(dotnetRoot); var manifestUpdater = new MockWorkloadManifestUpdater(); - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", mockWorkloadId }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", mockWorkloadId }); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetRoot, "6.0.100", workloadResolver, userProfileDir: testDirectory); var command = new WorkloadInstallCommand(parseResult, reporter: _reporter, workloadResolverFactory, workloadInstaller: installer, @@ -368,13 +368,13 @@ public void GivenWorkloadInstallItDoesNotRemoveOldInstallsOnRollback(bool userLo } // Successfully install a workload - var installParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", existingWorkload }); + var installParseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", existingWorkload }); var installCommand = new WorkloadInstallCommand(installParseResult, reporter: _reporter, workloadResolverFactory, nugetPackageDownloader: new MockNuGetPackageDownloader(tmpDir), workloadManifestUpdater: manifestUpdater, tempDirPath: testDirectory); installCommand.Execute(); // Install a workload with a mocked nuget failure - installParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", installingWorkload }); + installParseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", installingWorkload }); installCommand = new WorkloadInstallCommand(installParseResult, reporter: _reporter, workloadResolverFactory, nugetPackageDownloader: nugetDownloader, workloadManifestUpdater: manifestUpdater, tempDirPath: testDirectory); var exceptionThrown = Assert.Throws(() => installCommand.Execute()); @@ -400,7 +400,7 @@ public void GivenWorkloadInstallItTreatsPreviewsAsSeparateFeatureBands() var userProfileDir = Path.Combine(testDirectory, "user-profile"); var tmpDir = Path.Combine(testDirectory, "tmp"); var manifestPath = Path.Combine(_testAssetsManager.GetAndValidateTestProjectDirectory("SampleManifest"), "MockWorkloadsSample.json"); - + var manifestUpdater = new MockWorkloadManifestUpdater(); var prev7SdkFeatureVersion = "6.0.100-preview.7.21379.14"; var prev7FormattedFeatureVersion = "6.0.100-preview.7"; @@ -424,7 +424,7 @@ static void CreateFile(string path) var rc1WorkloadResolverFactory = new MockWorkloadResolverFactory(dotnetRoot, rc1SdkFeatureVersion, workloadResolver, userProfileDir); // Install a workload for preview 7 - var installParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", existingWorkload }); + var installParseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", existingWorkload }); var installCommand = new WorkloadInstallCommand(installParseResult, reporter: _reporter, prev7workloadResolverFactory, nugetPackageDownloader: new MockNuGetPackageDownloader(tmpDir), workloadManifestUpdater: manifestUpdater, tempDirPath: testDirectory); installCommand.Execute(); @@ -514,7 +514,7 @@ public void GivenWorkloadInstallItErrorsOnInvalidWorkloadRollbackFile() File.WriteAllText(rollbackFilePath, mockRollbackFileContent); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetRoot, sdkFeatureVersion, workloadResolver, userProfileDir); - var installParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", workload, "--from-rollback-file", rollbackFilePath }); + var installParseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", workload, "--from-rollback-file", rollbackFilePath }); var installCommand = new WorkloadInstallCommand(installParseResult, reporter: _reporter, workloadResolverFactory, nugetPackageDownloader: new MockNuGetPackageDownloader(tmpDir), tempDirPath: testDirectory); @@ -540,7 +540,7 @@ public void GivenWorkloadInstallItWarnsWhenManifestFromRollbackFileIsntInstalled File.WriteAllText(rollbackFilePath, mockRollbackFileContent); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetRoot, sdkFeatureVersion, workloadResolver, userProfileDir); - var installParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", workload, "--from-rollback-file", rollbackFilePath }); + var installParseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", workload, "--from-rollback-file", rollbackFilePath }); var installCommand = new WorkloadInstallCommand(installParseResult, reporter: _reporter, workloadResolverFactory, nugetPackageDownloader: new MockNuGetPackageDownloader(tmpDir), tempDirPath: testDirectory); @@ -563,7 +563,7 @@ public void GivenWorkloadInstallItWarnsWhenTheWorkloadIsAlreadyInstalled() var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetRoot, sdkFeatureVersion, workloadResolver, userProfileDir); // Successfully install a workload - var installParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", workloadId }); + var installParseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", workloadId }); var installCommand = new WorkloadInstallCommand(installParseResult, reporter: _reporter, workloadResolverFactory, nugetPackageDownloader: new MockNuGetPackageDownloader(tmpDir), workloadManifestUpdater: manifestUpdater, tempDirPath: testDirectory); installCommand.Execute() @@ -571,7 +571,7 @@ public void GivenWorkloadInstallItWarnsWhenTheWorkloadIsAlreadyInstalled() _reporter.Clear(); // Install again, this time it should tell you that you already have the workload installed - installParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", workloadId, "mock-2" }); + installParseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", workloadId, "mock-2" }); installCommand = new WorkloadInstallCommand(installParseResult, reporter: _reporter, workloadResolverFactory, nugetPackageDownloader: new MockNuGetPackageDownloader(tmpDir), workloadManifestUpdater: manifestUpdater, tempDirPath: testDirectory); installCommand.Execute() @@ -624,7 +624,7 @@ public void ShowManifestUpdatesWhenVerbosityIsDetailedOrDiagnostic(string verbos string sdkFeatureBand = "6.0.300"; var parseResult = - Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", verbosityFlag, "xamarin-android" }); + Parser.Parse(new string[] { "dotnet", "workload", "install", verbosityFlag, "xamarin-android" }); var manifestsToUpdate = new ManifestUpdateWithWorkloads[] { diff --git a/test/dotnet.Tests/CommandTests/Workload/Install/GivenWorkloadManifestUpdater.cs b/test/dotnet.Tests/CommandTests/Workload/Install/GivenWorkloadManifestUpdater.cs index 8c3424e3125f..4b63850cec2c 100644 --- a/test/dotnet.Tests/CommandTests/Workload/Install/GivenWorkloadManifestUpdater.cs +++ b/test/dotnet.Tests/CommandTests/Workload/Install/GivenWorkloadManifestUpdater.cs @@ -310,7 +310,7 @@ public async Task ItCanFallbackWithNoUpdates(bool useOfflineCache) Directory.CreateDirectory(Path.Combine(emptyInstalledManifestsDir, testManifestName)); File.WriteAllText(Path.Combine(emptyInstalledManifestsDir, testManifestName, _manifestFileName), GetManifestContent(new ManifestVersion("1.0.0"))); - var workloadManifestProvider = new MockManifestProvider((testManifestName, Path.Combine(emptyInstalledManifestsDir, testManifestName, _manifestFileName), "1.0.0", "6.0.200")) + var workloadManifestProvider = new MockManifestProvider((testManifestName, Path.Combine(emptyInstalledManifestsDir, testManifestName, _manifestFileName), "1.0.0", "6.0.200")) { SdkFeatureBand = new SdkFeatureBand(sdkFeatureBand) }; @@ -651,7 +651,7 @@ public async Task TestSideBySideUpdateChecks() (var updater2, var downloader2, var sentinelPath2, var resolver2) = GetTestUpdater(testDir: testDir, featureBand: "6.0.200"); new WorkloadConfigCommand( - Parser.Instance.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), + Parser.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), workloadResolverFactory: new MockWorkloadResolverFactory(testDir, "6.0.100", resolver1)).Execute().Should().Be(0); await updater1.BackgroundUpdateAdvertisingManifestsWhenRequiredAsync(); File.Exists(sentinelPath2).Should().BeFalse(); @@ -659,7 +659,7 @@ public async Task TestSideBySideUpdateChecks() downloader1.DownloadCallParams.Should().BeEquivalentTo(GetExpectedDownloadedPackages("6.0.100")); new WorkloadConfigCommand( - Parser.Instance.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), + Parser.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), workloadResolverFactory: new MockWorkloadResolverFactory(testDir, "6.0.200", resolver2)).Execute().Should().Be(0); await updater2.BackgroundUpdateAdvertisingManifestsWhenRequiredAsync(); File.Exists(sentinelPath2).Should().BeTrue(); @@ -693,7 +693,7 @@ public async Task TestSideBySideUpdateChecks() (var manifestUpdater, var packageDownloader, var sentinelPath, var workloadResolver) = GetTestUpdater(testDir, featureBand, testName, getEnvironmentVariable); var configCommand = new WorkloadConfigCommand( - Parser.Instance.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), + Parser.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), workloadResolverFactory: new MockWorkloadResolverFactory(testDir, featureBand, workloadResolver)); return (manifestUpdater, packageDownloader, sentinelPath, configCommand); } diff --git a/test/dotnet.Tests/CommandTests/Workload/Install/WorkloadInstallAspireDeprecationTests.cs b/test/dotnet.Tests/CommandTests/Workload/Install/WorkloadInstallAspireDeprecationTests.cs index 35a474541bab..301e57fca652 100644 --- a/test/dotnet.Tests/CommandTests/Workload/Install/WorkloadInstallAspireDeprecationTests.cs +++ b/test/dotnet.Tests/CommandTests/Workload/Install/WorkloadInstallAspireDeprecationTests.cs @@ -32,7 +32,7 @@ public void GivenOnlyAspireWorkloadItShowsDeprecationMessage() var manifestUpdater = new MockWorkloadManifestUpdater(); var workloadInstaller = new MockPackWorkloadInstaller(); - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", "aspire" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", "aspire" }); var command = new WorkloadInstallCommand( parseResult, @@ -67,7 +67,7 @@ public void GivenAspireWithOtherWorkloadsItShowsDeprecationAndInstallsOthers() var manifestUpdater = new MockWorkloadManifestUpdater(); var workloadInstaller = new MockPackWorkloadInstaller(); - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", "aspire", "xamarin-android" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", "aspire", "xamarin-android" }); var command = new WorkloadInstallCommand( parseResult, @@ -103,7 +103,7 @@ public void GivenAspireWorkloadDeprecationMessageIsShownOnlyOnce() var manifestUpdater = new MockWorkloadManifestUpdater(); var workloadInstaller = new MockPackWorkloadInstaller(); - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", "aspire", "xamarin-android" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", "aspire", "xamarin-android" }); var command = new WorkloadInstallCommand( parseResult, diff --git a/test/dotnet.Tests/CommandTests/Workload/List/GivenDotnetWorkloadList.cs b/test/dotnet.Tests/CommandTests/Workload/List/GivenDotnetWorkloadList.cs index 294986293638..bdea1f488242 100644 --- a/test/dotnet.Tests/CommandTests/Workload/List/GivenDotnetWorkloadList.cs +++ b/test/dotnet.Tests/CommandTests/Workload/List/GivenDotnetWorkloadList.cs @@ -21,8 +21,8 @@ public class GivenDotnetWorkloadList : SdkTest public GivenDotnetWorkloadList(ITestOutputHelper log) : base(log) { _reporter = new BufferedReporter(); - _machineReadableParseResult = Parser.Instance.Parse("dotnet workload list --machine-readable"); - _parseResult = Parser.Instance.Parse("dotnet workload list"); + _machineReadableParseResult = Parser.Parse("dotnet workload list --machine-readable"); + _parseResult = Parser.Parse("dotnet workload list"); _manifestPath = Path.Combine(_testAssetsManager.GetAndValidateTestProjectDirectory("SampleManifest"), "MockListSample.json"); } diff --git a/test/dotnet.Tests/CommandTests/Workload/List/GivenWorkloadInstallerAndWorkloadsInstalled.cs b/test/dotnet.Tests/CommandTests/Workload/List/GivenWorkloadInstallerAndWorkloadsInstalled.cs index 3a5132005a86..d92f89927668 100644 --- a/test/dotnet.Tests/CommandTests/Workload/List/GivenWorkloadInstallerAndWorkloadsInstalled.cs +++ b/test/dotnet.Tests/CommandTests/Workload/List/GivenWorkloadInstallerAndWorkloadsInstalled.cs @@ -96,7 +96,7 @@ private void Setup([CallerMemberName] string identifier = "") }) }; - ParseResult listParseResult = Parser.Instance.Parse(new[] + ParseResult listParseResult = Parser.Parse(new[] { "dotnet", "workload", "list", "--machine-readable", InstallingWorkloadCommandParser.VersionOption.Name, "7.0.100" }); @@ -148,7 +148,7 @@ public void ItShouldGetListOfWorkloadWithCurrentSdkVersionBand() public void GivenLowerTargetVersionItShouldThrow() { _workloadListCommand = new WorkloadListCommand( - Parser.Instance.Parse(new[] + Parser.Parse(new[] { "dotnet", "workload", "list", "--machine-readable", InstallingWorkloadCommandParser.VersionOption.Name, "5.0.306" }), @@ -168,7 +168,7 @@ public void GivenLowerTargetVersionItShouldThrow() public void GivenSameLowerTargetVersionBandItShouldNotThrow() { _workloadListCommand = new WorkloadListCommand( - Parser.Instance.Parse(new[] + Parser.Parse(new[] { "dotnet", "workload", "list", "--machine-readable", InstallingWorkloadCommandParser.VersionOption.Name, "6.0.100" }), diff --git a/test/dotnet.Tests/CommandTests/Workload/Repair/GivenDotnetWorkloadRepair.cs b/test/dotnet.Tests/CommandTests/Workload/Repair/GivenDotnetWorkloadRepair.cs index 1abf7488568e..4dc46351eae2 100644 --- a/test/dotnet.Tests/CommandTests/Workload/Repair/GivenDotnetWorkloadRepair.cs +++ b/test/dotnet.Tests/CommandTests/Workload/Repair/GivenDotnetWorkloadRepair.cs @@ -24,7 +24,7 @@ public class GivenDotnetWorkloadRepair : SdkTest public GivenDotnetWorkloadRepair(ITestOutputHelper log) : base(log) { _reporter = new BufferedReporter(); - _parseResult = Parser.Instance.Parse("dotnet workload repair"); + _parseResult = Parser.Parse("dotnet workload repair"); _manifestPath = Path.Combine(_testAssetsManager.GetAndValidateTestProjectDirectory("SampleManifest"), "Sample.json"); } @@ -78,7 +78,7 @@ public void GivenExtraPacksInstalledRepairGarbageCollects(bool userLocal) var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetRoot, sdkFeatureVersion, workloadResolver, userProfileDir); // Install a workload - var installParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", installingWorkload }); + var installParseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", installingWorkload }); var installCommand = new WorkloadInstallCommand(installParseResult, reporter: _reporter, workloadResolverFactory, nugetPackageDownloader: nugetDownloader, workloadManifestUpdater: manifestUpdater, tempDirPath: testDirectory); installCommand.Execute(); @@ -128,7 +128,7 @@ public void GivenMissingPacksRepairFixesInstall(bool userLocal) var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetRoot, sdkFeatureVersion, workloadResolver, userProfileDir); // Install a workload - var installParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", installingWorkload }); + var installParseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", installingWorkload }); var installCommand = new WorkloadInstallCommand(installParseResult, reporter: _reporter, workloadResolverFactory, nugetPackageDownloader: nugetDownloader, workloadManifestUpdater: manifestUpdater, tempDirPath: testDirectory); installCommand.Execute(); diff --git a/test/dotnet.Tests/CommandTests/Workload/Search/GivenDotnetWorkloadSearch.cs b/test/dotnet.Tests/CommandTests/Workload/Search/GivenDotnetWorkloadSearch.cs index 63178aed3d89..7fe5c47b8e2f 100644 --- a/test/dotnet.Tests/CommandTests/Workload/Search/GivenDotnetWorkloadSearch.cs +++ b/test/dotnet.Tests/CommandTests/Workload/Search/GivenDotnetWorkloadSearch.cs @@ -42,7 +42,7 @@ public GivenDotnetWorkloadSearch(ITestOutputHelper log) : base(log) public void GivenInvalidArgumentToWorkloadSearchVersionItFailsCleanly(string argument) { _reporter.Clear(); - var parseResult = Parser.Instance.Parse($"dotnet workload search version {argument}"); + var parseResult = Parser.Parse($"dotnet workload search version {argument}"); var workloadResolver = new MockWorkloadResolver(Enumerable.Empty()); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetPath: null, "9.0.100", workloadResolver); var command = () => new WorkloadSearchVersionsCommand(parseResult, _reporter, workloadResolverFactory); @@ -53,7 +53,7 @@ public void GivenInvalidArgumentToWorkloadSearchVersionItFailsCleanly(string arg public void GivenNoWorkloadsAreInstalledSearchIsEmpty() { _reporter.Clear(); - var parseResult = Parser.Instance.Parse("dotnet workload search"); + var parseResult = Parser.Parse("dotnet workload search"); var workloadResolver = new MockWorkloadResolver(Enumerable.Empty()); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetPath: null, "6.0.100", workloadResolver); var command = new WorkloadSearchCommand(parseResult, _reporter, workloadResolverFactory); @@ -95,7 +95,7 @@ public void GivenWorkloadSearchWithComponentsItFindsHighestMatchingSet() MockPackWorkloadInstaller installer = new(workloadSetContents: workloadSets); MockNuGetPackageDownloader nugetPackageDownloader = new(packageVersions: [new NuGetVersion("9.103.0"), new NuGetVersion("9.102.0"), new NuGetVersion("9.101.0"), new NuGetVersion("9.100.0")]); - var parseResult = Parser.Instance.Parse("dotnet workload search version android@17.5.9 macos@14.5.92 --take 1"); + var parseResult = Parser.Parse("dotnet workload search version android@17.5.9 macos@14.5.92 --take 1"); MockWorkloadResolver resolver = new( [new WorkloadResolver.WorkloadInfo(new WorkloadId("Microsoft.NET.Sdk.Android"), null), new WorkloadResolver.WorkloadInfo(new WorkloadId("Microsoft.NET.Sdk.macOS"), null), @@ -114,7 +114,7 @@ [new WorkloadResolver.WorkloadInfo(new WorkloadId("Microsoft.NET.Sdk.Android"), public void GivenNoStubIsProvidedSearchShowsAllWorkloads() { _reporter.Clear(); - var parseResult = Parser.Instance.Parse("dotnet workload search"); + var parseResult = Parser.Parse("dotnet workload search"); var workloadResolver = new MockWorkloadResolver(_availableWorkloads); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetPath: null, "6.0.100", workloadResolver); var command = new WorkloadSearchCommand(parseResult, _reporter, workloadResolverFactory); @@ -135,7 +135,7 @@ public void GivenNoStubIsProvidedSearchShowsAllWorkloads() public void GivenDetailedVerbositySearchShowsAllColumns() { _reporter.Clear(); - var parseResult = Parser.Instance.Parse("dotnet workload search -v d"); + var parseResult = Parser.Parse("dotnet workload search -v d"); var workloadResolver = new MockWorkloadResolver(_availableWorkloads); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetPath: null, "6.0.100", workloadResolver); var command = new WorkloadSearchCommand(parseResult, _reporter, workloadResolverFactory); @@ -156,7 +156,7 @@ public void GivenDetailedVerbositySearchShowsAllColumns() public void GivenStubIsProvidedSearchShowsAllMatchingWorkloads() { _reporter.Clear(); - var parseResult = Parser.Instance.Parse("dotnet workload search mock"); + var parseResult = Parser.Parse("dotnet workload search mock"); var workloadResolver = new MockWorkloadResolver(_availableWorkloads); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetPath: null, "6.0.100", workloadResolver); var command = new WorkloadSearchCommand(parseResult, _reporter, workloadResolverFactory); @@ -178,7 +178,7 @@ public void GivenStubIsProvidedSearchShowsAllMatchingWorkloads() public void GivenSearchResultsAreOrdered() { _reporter.Clear(); - var parseResult = Parser.Instance.Parse("dotnet workload search"); + var parseResult = Parser.Parse("dotnet workload search"); var workloadResolver = new MockWorkloadResolver(_availableWorkloads); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetPath: null, "6.0.100", workloadResolver); var command = new WorkloadSearchCommand(parseResult, _reporter, workloadResolverFactory); @@ -195,7 +195,7 @@ public void GivenSearchResultsAreOrdered() public void GivenWorkloadSearchItSearchesDescription() { _reporter.Clear(); - var parseResult = Parser.Instance.Parse("dotnet workload search description"); + var parseResult = Parser.Parse("dotnet workload search description"); var workloadResolver = new MockWorkloadResolver(_availableWorkloads); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetPath: null, "6.0.100", workloadResolver); var command = new WorkloadSearchCommand(parseResult, _reporter, workloadResolverFactory); diff --git a/test/dotnet.Tests/CommandTests/Workload/Uninstall/GivenDotnetWorkloadUninstall.cs b/test/dotnet.Tests/CommandTests/Workload/Uninstall/GivenDotnetWorkloadUninstall.cs index cabfdaa0a8f3..ad857578118f 100644 --- a/test/dotnet.Tests/CommandTests/Workload/Uninstall/GivenDotnetWorkloadUninstall.cs +++ b/test/dotnet.Tests/CommandTests/Workload/Uninstall/GivenDotnetWorkloadUninstall.cs @@ -206,7 +206,7 @@ private void InstallWorkload(string installingWorkload, string testDirectory, st var workloadResolver = WorkloadResolver.CreateForTests(new MockManifestProvider(new[] { _manifestPath }), dotnetRoot, userLocal, userProfileDir); var nugetDownloader = new MockNuGetPackageDownloader(dotnetRoot); var manifestUpdater = new MockWorkloadManifestUpdater(); - var installParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", installingWorkload }); + var installParseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", installingWorkload }); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetRoot, sdkFeatureVersion, workloadResolver, userProfileDir); var installCommand = new WorkloadInstallCommand(installParseResult, reporter: _reporter, workloadResolverFactory, nugetPackageDownloader: nugetDownloader, workloadManifestUpdater: manifestUpdater, tempDirPath: testDirectory); @@ -227,7 +227,7 @@ private int UninstallWorkload(string uninstallingWorkload, string testDirectory, command.AddRange(args); } - var uninstallParseResult = Parser.Instance.Parse(command); + var uninstallParseResult = Parser.Parse([.. command]); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetRoot, sdkFeatureVersion, workloadResolver, userProfileDir); var uninstallCommand = new WorkloadUninstallCommand(uninstallParseResult, reporter: _reporter, workloadResolverFactory, nugetDownloader); return uninstallCommand.Execute(); diff --git a/test/dotnet.Tests/CommandTests/Workload/Update/GivenDotnetWorkloadUpdate.cs b/test/dotnet.Tests/CommandTests/Workload/Update/GivenDotnetWorkloadUpdate.cs index ff77d6d5046a..3f0a820e801d 100644 --- a/test/dotnet.Tests/CommandTests/Workload/Update/GivenDotnetWorkloadUpdate.cs +++ b/test/dotnet.Tests/CommandTests/Workload/Update/GivenDotnetWorkloadUpdate.cs @@ -32,7 +32,7 @@ public GivenDotnetWorkloadUpdate(ITestOutputHelper log) : base(log) { _reporter = new BufferedReporter(); _manifestPath = Path.Combine(_testAssetsManager.GetAndValidateTestProjectDirectory("SampleManifest"), "Sample.json"); - _parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "update" }); + _parseResult = Parser.Parse(new string[] { "dotnet", "workload", "update" }); } [Fact] @@ -92,7 +92,7 @@ public void GivenWorkloadUpdateFromHistory() IWorkloadManifestUpdater mockUpdater = new MockWorkloadManifestUpdater(resolver: workloadResolver); WorkloadUpdateCommand update = new( - Parser.Instance.Parse(new string[] { "dotnet", "workload", "update", "--from-history", "2" }), + Parser.Parse(new string[] { "dotnet", "workload", "update", "--from-history", "2" }), Reporter.Output, mockResolverFactory, mockInstaller, @@ -130,7 +130,7 @@ public void GivenWorkloadUpdateItRemovesOldPacksAfterInstall(bool userLocal) var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetRoot, sdkFeatureVersion, workloadResolver, userProfileDir); // Install a workload - var installParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "install", installingWorkload }); + var installParseResult = Parser.Parse(new string[] { "dotnet", "workload", "install", installingWorkload }); var installCommand = new WorkloadInstallCommand(installParseResult, reporter: _reporter, workloadResolverFactory, nugetPackageDownloader: nugetDownloader, workloadManifestUpdater: manifestUpdater, tempDirPath: testDirectory); installCommand.Execute(); @@ -164,7 +164,7 @@ public void GivenWorkloadUpdateItRemovesOldPacksAfterInstall(bool userLocal) dotnetRoot, userLocal, userProfileDir); // Update workload - var updateParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "update" }); + var updateParseResult = Parser.Parse(new string[] { "dotnet", "workload", "update" }); var updateCommand = new WorkloadUpdateCommand(updateParseResult, reporter: _reporter, workloadResolverFactory, nugetPackageDownloader: nugetDownloader, workloadManifestUpdater: manifestUpdater, tempDirPath: testDirectory); updateCommand.Execute(); @@ -240,8 +240,8 @@ public void GivenWorkloadUpdateAcrossFeatureBandsItUpdatesPacks(bool userLocal) File.Create(Path.Combine(installRoot, "metadata", "workloads", sdkFeatureVersion, "InstalledWorkloads", installingWorkload)).Close(); // Update workload (without installing any workloads to this feature band) - new WorkloadConfigCommand(Parser.Instance.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), workloadResolverFactory: workloadResolverFactory).Execute().Should().Be(0); - var updateParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "update", "--from-previous-sdk" }); + new WorkloadConfigCommand(Parser.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), workloadResolverFactory: workloadResolverFactory).Execute().Should().Be(0); + var updateParseResult = Parser.Parse(new string[] { "dotnet", "workload", "update", "--from-previous-sdk" }); var updateCommand = new WorkloadUpdateCommand(updateParseResult, reporter: _reporter, workloadResolverFactory, nugetPackageDownloader: nugetDownloader, workloadManifestUpdater: manifestUpdater, tempDirPath: testDirectory); var installStatePath = Path.Combine(WorkloadInstallType.GetInstallStateFolder(new SdkFeatureBand(sdkFeatureVersion), installRoot), "default.json"); @@ -252,7 +252,7 @@ public void GivenWorkloadUpdateAcrossFeatureBandsItUpdatesPacks(bool userLocal) }; Directory.CreateDirectory(Path.GetDirectoryName(installStatePath)); File.WriteAllText(installStatePath, oldInstallState.ToString()); - new WorkloadConfigCommand(Parser.Instance.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), workloadResolverFactory: workloadResolverFactory).Execute().Should().Be(0); + new WorkloadConfigCommand(Parser.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]), workloadResolverFactory: workloadResolverFactory).Execute().Should().Be(0); updateCommand.Execute(); var newInstallState = InstallStateContents.FromPath(installStatePath); newInstallState.Manifests.Should().BeNull(); @@ -319,7 +319,7 @@ public void UpdateViaWorkloadSet(bool upgrade, bool? installStateUseWorkloadSet, ], fromWorkloadSet: true, workloadSetVersion: workloadSetVersion); var resolverFactory = new MockWorkloadResolverFactory(dotnetDir, sdkVersion, workloadResolver, userProfileDir); - var updateCommand = new WorkloadUpdateCommand(Parser.Instance.Parse("dotnet workload update"), Reporter.Output, resolverFactory, workloadInstaller, nugetPackageDownloader, workloadManifestUpdater, shouldUseWorkloadSetsFromGlobalJson: globalJsonValue); + var updateCommand = new WorkloadUpdateCommand(Parser.Parse("dotnet workload update"), Reporter.Output, resolverFactory, workloadInstaller, nugetPackageDownloader, workloadManifestUpdater, shouldUseWorkloadSetsFromGlobalJson: globalJsonValue); var installStatePath = Path.Combine(dotnetDir, "metadata", "workloads", RuntimeInformation.ProcessArchitecture.ToString(), sdkVersion, "InstallState", "default.json"); var contents = new InstallStateContents(); @@ -369,7 +369,7 @@ public void GivenWorkloadUpdateItFindsGreatestWorkloadSetWithSpecifiedComponents { "9.0.103", workloadSet4 } }; - var parseResult = Parser.Instance.Parse("dotnet workload update --version ios@17.5.9 macos@14.5.92"); + var parseResult = Parser.Parse("dotnet workload update --version ios@17.5.9 macos@14.5.92"); MockPackWorkloadInstaller installer = new(workloadSetContents: workloadSets); var testDirectory = _testAssetsManager.CreateTestDirectory(testName: "GivenWorkloadUpdateItFindsGreatestWorkloadSetWithSpecifiedComponents").Path; WorkloadManifest iosManifest = WorkloadManifest.CreateForTests("Microsoft.NET.Sdk.iOS"); @@ -419,7 +419,7 @@ public void GivenWorkloadUpdateItCanDownloadToOfflineCache() { var mockWorkloadIds = new WorkloadId[] { new WorkloadId("xamarin-android") }; var cachePath = Path.Combine(_testAssetsManager.CreateTestDirectory(identifier: "cachePath").Path, "mockCachePath"); - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "update", "--download-to-cache", cachePath }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "update", "--download-to-cache", cachePath }); (_, var command, _, _, var manifestUpdater, var packageDownloader, _) = GetTestInstallers(parseResult, installedWorkloads: mockWorkloadIds, includeInstalledPacks: true, installedFeatureBand: "6.0.100"); command.Execute(); @@ -440,7 +440,7 @@ public void GivenWorkloadUpdateItCanInstallFromOfflineCache() { var mockWorkloadIds = new WorkloadId[] { new WorkloadId("xamarin-android") }; var cachePath = "mockCachePath"; - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "update", "--from-cache", cachePath }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "update", "--from-cache", cachePath }); (_, var command, var installer, _, _, var nugetDownloader, _) = GetTestInstallers(parseResult, installedWorkloads: mockWorkloadIds, installedFeatureBand: "6.0.100"); command.Execute(); @@ -456,7 +456,7 @@ public void GivenWorkloadUpdateItCanInstallFromOfflineCache() public void GivenWorkloadUpdateItPrintsDownloadUrls() { var mockWorkloadIds = new WorkloadId[] { new WorkloadId("xamarin-android") }; - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "update", "--print-download-link-only" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "update", "--print-download-link-only" }); (_, var command, _, _, _, _, _) = GetTestInstallers(parseResult, installedWorkloads: mockWorkloadIds, includeInstalledPacks: true, installedFeatureBand: "6.0.100"); command.Execute(); @@ -470,7 +470,7 @@ public void GivenWorkloadUpdateItPrintsDownloadUrls() public void GivenWorkloadUpdateItPrintsDownloadUrlsForNewFeatureBand() { var mockWorkloadIds = new WorkloadId[] { new WorkloadId("xamarin-android") }; - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "update", "--print-download-link-only", "--sdk-version", "7.0.100" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "update", "--print-download-link-only", "--sdk-version", "7.0.100" }); (_, var command, _, _, _, _, _) = GetTestInstallers(parseResult, installedWorkloads: mockWorkloadIds, includeInstalledPacks: true, sdkVersion: "6.0.400"); command.Execute(); @@ -487,7 +487,7 @@ public void GivenWorkloadUpdateWithSdkVersionItErrors() var dotnetRoot = Path.Combine(testDirectory, "dotnet"); var userProfileDir = Path.Combine(testDirectory, "user-profile"); var sdkFeatureVersion = "7.0.100"; - var updateParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "update", "--sdk-version", sdkFeatureVersion }); + var updateParseResult = Parser.Parse(new string[] { "dotnet", "workload", "update", "--sdk-version", sdkFeatureVersion }); var workloadResolverFactory = new MockWorkloadResolverFactory(dotnetRoot, sdkFeatureVersion, workloadResolver: null, userProfileDir); @@ -498,7 +498,7 @@ public void GivenWorkloadUpdateWithSdkVersionItErrors() [Fact] public void GivenOnlyUpdateAdManifestItSucceeds() { - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "update", "--advertising-manifests-only" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "update", "--advertising-manifests-only" }); (_, var command, _, _, var manifestUpdater, _, _) = GetTestInstallers(parseResult, installedFeatureBand: "6.0.100"); command.Execute(); @@ -508,7 +508,7 @@ public void GivenOnlyUpdateAdManifestItSucceeds() [Fact] public void GivenPrintRollbackDefinitionItIncludesAllInstalledManifests() { - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "update", "--print-rollback" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "update", "--print-rollback" }); (_, var updateCommand, _, _, _, _, _) = GetTestInstallers(parseResult, installedFeatureBand: "6.0.100"); @@ -527,7 +527,7 @@ public void GivenPrintRollbackDefinitionItIncludesAllInstalledManifests() [InlineData("6.0.300", "5.0.100")] public void ApplyRollbackAcrossFeatureBand(string existingSdkFeatureBand, string newSdkFeatureBand) { - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "update", "--from-rollback-file", "rollback.json" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "update", "--from-rollback-file", "rollback.json" }); var manifestsToUpdate = new ManifestUpdateWithWorkloads[] @@ -536,7 +536,7 @@ public void ApplyRollbackAcrossFeatureBand(string existingSdkFeatureBand, string }; (var dotnetPath, var updateCommand, var packInstaller, _, _, _, var resolverFactory) = GetTestInstallers(parseResult, manifestUpdates: manifestsToUpdate, sdkVersion: "6.0.300", identifier: existingSdkFeatureBand + newSdkFeatureBand, installedFeatureBand: existingSdkFeatureBand); - parseResult = Parser.Instance.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]); + parseResult = Parser.Parse(["dotnet", "workload", "config", "--update-mode", "manifests"]); WorkloadConfigCommand configCommand = new(parseResult, workloadResolverFactory: resolverFactory); configCommand.Execute().Should().Be(0); updateCommand.Execute() @@ -557,7 +557,7 @@ public void ApplyRollbackAcrossFeatureBand(string existingSdkFeatureBand, string [Fact] public void ApplyRollbackWithMultipleManifestsAcrossFeatureBand() { - var parseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "update", "--from-rollback-file", "rollback.json" }); + var parseResult = Parser.Parse(new string[] { "dotnet", "workload", "update", "--from-rollback-file", "rollback.json" }); var manifestsToUpdate = new ManifestUpdateWithWorkloads[] @@ -593,7 +593,7 @@ public void GivenInvalidVersionInRollbackFileItErrors() var rollbackFilePath = Path.Combine(testDirectory, "rollback.json"); File.WriteAllText(rollbackFilePath, mockRollbackFileContent); - var updateParseResult = Parser.Instance.Parse(new string[] { "dotnet", "workload", "update", "--from-rollback-file", rollbackFilePath }); + var updateParseResult = Parser.Parse(new string[] { "dotnet", "workload", "update", "--from-rollback-file", rollbackFilePath }); string sdkVersion = "6.0.100"; diff --git a/test/dotnet.Tests/ParserTests/ParseResultExtensionsTests.cs b/test/dotnet.Tests/ParserTests/ParseResultExtensionsTests.cs index 04099d5791b6..cdbce16e93d2 100644 --- a/test/dotnet.Tests/ParserTests/ParseResultExtensionsTests.cs +++ b/test/dotnet.Tests/ParserTests/ParseResultExtensionsTests.cs @@ -23,7 +23,7 @@ public ParseResultExtensionsTests(ITestOutputHelper output) [InlineData("ignore list", "ignore")] // Global tool public void RootSubCommandResultReturnsCorrectSubCommand(string input, string expected) { - var result = Parser.Instance.Parse(input); + var result = Parser.Parse(input); result.RootSubCommandResult() .Should() diff --git a/test/dotnet.Tests/ParserTests/ResponseFileTests.cs b/test/dotnet.Tests/ParserTests/ResponseFileTests.cs index a4bb3cdd23ea..4000d4bb2a86 100644 --- a/test/dotnet.Tests/ParserTests/ResponseFileTests.cs +++ b/test/dotnet.Tests/ParserTests/ResponseFileTests.cs @@ -24,8 +24,7 @@ public void Can_safely_expand_response_file_lines() }; File.WriteAllLines(tempFilePath, lines); - var parser = Parser.Instance; - var parseResult = parser.Parse(new[] { "dotnet", $"@{tempFilePath}" }); + var parseResult = Parser.Parse(new[] { "dotnet", $"@{tempFilePath}" }); var tokens = parseResult.Tokens.Select(t => t.Value); var tokenString = string.Join(", ", tokens); @@ -57,8 +56,7 @@ public void Can_skip_empty_and_commented_lines() }; File.WriteAllLines(tempFilePath, lines); - var parser = Parser.Instance; - var parseResult = parser.Parse(new[] { "dotnet", $"@{tempFilePath}" }); + var parseResult = Parser.Parse(new[] { "dotnet", $"@{tempFilePath}" }); var tokens = parseResult.Tokens.Select(t => t.Value); var tokenized = new[] { "build", diff --git a/test/dotnet.Tests/TelemetryFilterTest.cs b/test/dotnet.Tests/TelemetryFilterTest.cs index 74e9335eea01..115f5fb3086d 100644 --- a/test/dotnet.Tests/TelemetryFilterTest.cs +++ b/test/dotnet.Tests/TelemetryFilterTest.cs @@ -30,7 +30,7 @@ public TelemetryFilterTests(ITestOutputHelper log) : base(log) [Fact] public void TopLevelCommandNameShouldBeSentToTelemetryWithoutPerformanceData() { - var parseResult = Parser.Instance.Parse(new List() { "build" }); + var parseResult = Parser.Parse(["build"]); TelemetryEventEntry.SendFiltered(parseResult); _fakeTelemetry.LogEntries.Should().Contain(e => e.EventName == "toplevelparser/command" && e.Properties.ContainsKey("verb") && @@ -41,7 +41,7 @@ public void TopLevelCommandNameShouldBeSentToTelemetryWithoutPerformanceData() [Fact] public void TopLevelCommandNameShouldBeSentToTelemetryWithPerformanceData() { - var parseResult = Parser.Instance.Parse(new List() { "build" }); + var parseResult = Parser.Parse(["build"]); TelemetryEventEntry.SendFiltered(Tuple.Create(parseResult, new Dictionary() { { "Startup Time", 12345 } })); _fakeTelemetry.LogEntries.Should().Contain(e => e.EventName == "toplevelparser/command" && e.Properties.ContainsKey("verb") && @@ -53,7 +53,7 @@ public void TopLevelCommandNameShouldBeSentToTelemetryWithPerformanceData() [Fact] public void TopLevelCommandNameShouldBeSentToTelemetryWithZeroPerformanceData() { - var parseResult = Parser.Instance.Parse(new List() { "build" }); + var parseResult = Parser.Parse(["build"]); TelemetryEventEntry.SendFiltered(Tuple.Create(parseResult, new Dictionary() { { "Startup Time", 0 } })); _fakeTelemetry.LogEntries.Should().Contain(e => e.EventName == "toplevelparser/command" && e.Properties.ContainsKey("verb") && @@ -64,7 +64,7 @@ public void TopLevelCommandNameShouldBeSentToTelemetryWithZeroPerformanceData() [Fact] public void TopLevelCommandNameShouldBeSentToTelemetryWithSomeZeroPerformanceData() { - var parseResult = Parser.Instance.Parse(new List() { "build" }); + var parseResult = Parser.Parse(["build"]); TelemetryEventEntry.SendFiltered(Tuple.Create(parseResult, new Dictionary() { { "Startup Time", 0 }, { "Parse Time", 23456 } })); _fakeTelemetry.LogEntries.Should().Contain(e => e.EventName == "toplevelparser/command" && e.Properties.ContainsKey("verb") && @@ -77,7 +77,7 @@ public void TopLevelCommandNameShouldBeSentToTelemetryWithSomeZeroPerformanceDat [Fact] public void SubLevelCommandNameShouldBeSentToTelemetryWithoutPerformanceData() { - var parseResult = Parser.Instance.Parse(new List() { "new", "console" }); + var parseResult = Parser.Parse(["new", "console"]); TelemetryEventEntry.SendFiltered(parseResult); _fakeTelemetry .LogEntries.Should() @@ -92,7 +92,7 @@ public void SubLevelCommandNameShouldBeSentToTelemetryWithoutPerformanceData() [Fact] public void SubLevelCommandNameShouldBeSentToTelemetryWithPerformanceData() { - var parseResult = Parser.Instance.Parse(new List() { "new", "console" }); + var parseResult = Parser.Parse(["new", "console"]); TelemetryEventEntry.SendFiltered(Tuple.Create(parseResult, new Dictionary() { { "Startup Time", 34567 } })); _fakeTelemetry.LogEntries.Should().Contain(e => e.EventName == "sublevelparser/command" && e.Properties.ContainsKey("argument") && @@ -106,7 +106,7 @@ public void SubLevelCommandNameShouldBeSentToTelemetryWithPerformanceData() [Fact] public void SubLevelCommandNameShouldBeSentToTelemetryWithZeroPerformanceData() { - var parseResult = Parser.Instance.Parse(new List() { "new", "console" }); + var parseResult = Parser.Parse(["new", "console"]); TelemetryEventEntry.SendFiltered(Tuple.Create(parseResult, new Dictionary() { { "Startup Time", 0 } })); _fakeTelemetry.LogEntries.Should().Contain(e => e.EventName == "sublevelparser/command" && e.Properties.ContainsKey("argument") && @@ -119,7 +119,7 @@ public void SubLevelCommandNameShouldBeSentToTelemetryWithZeroPerformanceData() [Fact] public void SubLevelCommandNameShouldBeSentToTelemetryWithSomeZeroPerformanceData() { - var parseResult = Parser.Instance.Parse(new List() { "new", "console" }); + var parseResult = Parser.Parse(["new", "console"]); TelemetryEventEntry.SendFiltered(Tuple.Create(parseResult, new Dictionary() { { "Startup Time", 0 }, { "Parse Time", 45678 } })); _fakeTelemetry.LogEntries.Should().Contain(e => e.EventName == "sublevelparser/command" && e.Properties.ContainsKey("argument") && @@ -135,7 +135,7 @@ public void SubLevelCommandNameShouldBeSentToTelemetryWithSomeZeroPerformanceDat public void WorkloadSubLevelCommandNameAndArgumentShouldBeSentToTelemetry() { var parseResult = - Parser.Instance.Parse(new List() { "workload", "install", "microsoft-ios-sdk-full" }); + Parser.Parse(["workload", "install", "microsoft-ios-sdk-full"]); TelemetryEventEntry.SendFiltered(Tuple.Create(parseResult, new Dictionary() { { "Startup Time", 0 }, { "Parse Time", 23456 } })); _fakeTelemetry.LogEntries.Should().Contain(e => e.EventName == "sublevelparser/command" && @@ -151,7 +151,7 @@ public void WorkloadSubLevelCommandNameAndArgumentShouldBeSentToTelemetry() public void ToolsSubLevelCommandNameAndArgumentShouldBeSentToTelemetry() { var parseResult = - Parser.Instance.Parse(new List() { "tool", "install", "dotnet-format" }); + Parser.Parse(["tool", "install", "dotnet-format"]); TelemetryEventEntry.SendFiltered(Tuple.Create(parseResult, new Dictionary() { { "Startup Time", 0 }, { "Parse Time", 23456 } })); _fakeTelemetry.LogEntries.Should().Contain(e => e.EventName == "sublevelparser/command" && @@ -167,7 +167,7 @@ public void ToolsSubLevelCommandNameAndArgumentShouldBeSentToTelemetry() public void WhenCalledWithDiagnosticWorkloadSubLevelCommandNameAndArgumentShouldBeSentToTelemetry() { var parseResult = - Parser.Instance.Parse(new List() { "-d", "workload", "install", "microsoft-ios-sdk-full" }); + Parser.Parse(["-d", "workload", "install", "microsoft-ios-sdk-full"]); TelemetryEventEntry.SendFiltered(Tuple.Create(parseResult, new Dictionary() { { "Startup Time", 0 }, { "Parse Time", 23456 } })); _fakeTelemetry.LogEntries.Should().Contain(e => e.EventName == "sublevelparser/command" && @@ -183,7 +183,7 @@ public void WhenCalledWithDiagnosticWorkloadSubLevelCommandNameAndArgumentShould public void WhenCalledWithMissingArgumentWorkloadSubLevelCommandNameAndArgumentShouldBeSentToTelemetry() { var parseResult = - Parser.Instance.Parse(new List() { "-d", "workload", "install" }); + Parser.Parse(["-d", "workload", "install"]); TelemetryEventEntry.SendFiltered(Tuple.Create(parseResult, new Dictionary() { { "Startup Time", 0 }, { "Parse Time", 23456 } })); _fakeTelemetry.LogEntries.Should().Contain(e => e.EventName == "sublevelparser/command" &&