diff --git a/NuGet.config b/NuGet.config
index 52f8c9735c20..de13d2146ccf 100644
--- a/NuGet.config
+++ b/NuGet.config
@@ -6,6 +6,7 @@
+
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 016f46a04332..2a1991ff48eb 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -52,26 +52,26 @@
bebe955e9f7d392fbca594b1c76c54ba2e27027e
-
+
https://github.com/dotnet/msbuild
- 3847162365a20626dbef16f2b1153dada9c26965
-
+ 6cdef424154c976f04802b101e6be6292f8a8897
-
+
https://github.com/dotnet/msbuild
- 3847162365a20626dbef16f2b1153dada9c26965
+ 6cdef424154c976f04802b101e6be6292f8a8897
-
+
https://github.com/dotnet/msbuild
- 3847162365a20626dbef16f2b1153dada9c26965
+ 6cdef424154c976f04802b101e6be6292f8a8897
+
-
+
https://github.com/dotnet/fsharp
- c57ae10ab3ef9a9c024abc77ed53cb46f3ad6903
+ 10f956e631a1efc0f7f5e49c626c494cd32b1f50
-
+
https://github.com/dotnet/fsharp
- c57ae10ab3ef9a9c024abc77ed53cb46f3ad6903
+ 10f956e631a1efc0f7f5e49c626c494cd32b1f50
@@ -79,34 +79,34 @@
6a6de7dccf80a4a7247f0d67aa5df0062d460edb
-
+
https://github.com/dotnet/roslyn
- bdd9c5ba66b00beebdc3516acc5e29b83efd89af
+ a0f635227f57c805c30ebb06a5afecacc77035f5
-
+
https://github.com/dotnet/roslyn
- bdd9c5ba66b00beebdc3516acc5e29b83efd89af
+ a0f635227f57c805c30ebb06a5afecacc77035f5
-
+
https://github.com/dotnet/roslyn
- bdd9c5ba66b00beebdc3516acc5e29b83efd89af
+ a0f635227f57c805c30ebb06a5afecacc77035f5
-
+
https://github.com/dotnet/roslyn
- bdd9c5ba66b00beebdc3516acc5e29b83efd89af
+ a0f635227f57c805c30ebb06a5afecacc77035f5
-
+
https://github.com/dotnet/roslyn
- bdd9c5ba66b00beebdc3516acc5e29b83efd89af
+ a0f635227f57c805c30ebb06a5afecacc77035f5
-
+
https://github.com/dotnet/roslyn
- bdd9c5ba66b00beebdc3516acc5e29b83efd89af
+ a0f635227f57c805c30ebb06a5afecacc77035f5
-
+
https://github.com/dotnet/roslyn
- bdd9c5ba66b00beebdc3516acc5e29b83efd89af
+ a0f635227f57c805c30ebb06a5afecacc77035f5
https://github.com/dotnet/aspnetcore
@@ -116,69 +116,69 @@
https://github.com/dotnet/aspnetcore
fa54329186df2e11b40bdfec4ae08f16fdbe9d99
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
-
+
https://github.com/nuget/nuget.client
- f47eb5771ee3f9a100d0b31d82ccb5ee600a56ed
+ 0dd5a1ea536201af94725353e4bc711d7560b246
https://github.com/microsoft/vstest
@@ -278,18 +278,18 @@
https://github.com/dotnet/aspnetcore
fa54329186df2e11b40bdfec4ae08f16fdbe9d99
-
+
https://github.com/dotnet/razor
- 79fc2ed7f974c9d93b09a9f5de9dac0569838c8d
+ 098adbd749333545ee11dfb7798526bddc736451
-
+
https://github.com/dotnet/razor
- 79fc2ed7f974c9d93b09a9f5de9dac0569838c8d
+ 098adbd749333545ee11dfb7798526bddc736451
-
+
https://github.com/dotnet/razor
- 79fc2ed7f974c9d93b09a9f5de9dac0569838c8d
+ 098adbd749333545ee11dfb7798526bddc736451
https://github.com/dotnet/aspnetcore
@@ -312,17 +312,17 @@
9a1c3e1b7f0c8763d4c96e593961a61a72679a7b
-
+
https://github.com/dotnet/roslyn-analyzers
- 4aefee9f788e07c480a69518f38901bf7b19d9be
+ 2dbc0e4795ffd194777b3dc4efdf7c9b26002b04
-
+
https://github.com/dotnet/roslyn-analyzers
- 4aefee9f788e07c480a69518f38901bf7b19d9be
+ 2dbc0e4795ffd194777b3dc4efdf7c9b26002b04
-
+
https://github.com/dotnet/roslyn-analyzers
- 4aefee9f788e07c480a69518f38901bf7b19d9be
+ 2dbc0e4795ffd194777b3dc4efdf7c9b26002b04
@@ -334,14 +334,14 @@
02fe27cd6a9b001c8feb7938e6ef4b3799745759
-
+
https://github.com/dotnet/source-build-externals
- 57102f65c7bfffc8ce50818cb7066942edfcaefd
+ e45d334fa3fd29018b70c598eced1938c054884d
-
+
https://github.com/dotnet/source-build-reference-packages
- b88b567fbf54c5404d039b80cfb86f09a681f604
+ 0650b50b2a5263c735d12b5c36c5deb34e7e6b60
diff --git a/eng/Versions.props b/eng/Versions.props
index a39206c13673..531fce791e76 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -64,18 +64,18 @@
- 6.8.0-rc.112
- 6.8.0-rc.112
+ 6.8.0-rc.122
+ 6.8.0-rc.122
6.0.0-rc.278
- 6.8.0-rc.112
- 6.8.0-rc.112
- 6.8.0-rc.112
- 6.8.0-rc.112
- 6.8.0-rc.112
- 6.8.0-rc.112
- 6.8.0-rc.112
- 6.8.0-rc.112
- 6.8.0-rc.112
+ 6.8.0-rc.122
+ 6.8.0-rc.122
+ 6.8.0-rc.122
+ 6.8.0-rc.122
+ 6.8.0-rc.122
+ 6.8.0-rc.122
+ 6.8.0-rc.122
+ 6.8.0-rc.122
+ 6.8.0-rc.122
$(NuGetPackagingPackageVersion)
$(NuGetProjectModelPackageVersion)
@@ -97,12 +97,12 @@
- 9.0.0-preview.23471.1
- 3.11.0-beta1.23471.1
+ 9.0.0-preview.23475.2
+ 3.11.0-beta1.23475.2
- 17.8.0-preview-23471-08
+ 17.8.0
$(MicrosoftBuildPackageVersion)
- 12.8.0-beta.23472.1
+ 12.8.0-beta.23475.2
- 4.8.0-3.23471.11
- 4.8.0-3.23471.11
- 4.8.0-3.23471.11
- 4.8.0-3.23471.11
- 4.8.0-3.23471.11
- 4.8.0-3.23471.11
- 4.8.0-3.23471.11
+ 4.8.0-3.23477.1
+ 4.8.0-3.23477.1
+ 4.8.0-3.23477.1
+ 4.8.0-3.23477.1
+ 4.8.0-3.23477.1
+ 4.8.0-3.23477.1
+ 4.8.0-3.23477.1
$(MicrosoftNetCompilersToolsetPackageVersion)
@@ -157,9 +157,9 @@
- 7.0.0-preview.23472.1
- 7.0.0-preview.23472.1
- 7.0.0-preview.23472.1
+ 7.0.0-preview.23476.1
+ 7.0.0-preview.23476.1
+ 7.0.0-preview.23476.1
@@ -167,7 +167,7 @@
- 1.6.1
+ 1.6.10
4.0.1
diff --git a/src/BuiltInTools/dotnet-watch/Internal/FileWatcher/PollingFileWatcher.cs b/src/BuiltInTools/dotnet-watch/Internal/FileWatcher/PollingFileWatcher.cs
index 405a93d321ec..0aeb6483e4ac 100644
--- a/src/BuiltInTools/dotnet-watch/Internal/FileWatcher/PollingFileWatcher.cs
+++ b/src/BuiltInTools/dotnet-watch/Internal/FileWatcher/PollingFileWatcher.cs
@@ -31,9 +31,11 @@ public PollingFileWatcher(string watchedDirectory)
_watchedDirectory = new DirectoryInfo(watchedDirectory);
BasePath = _watchedDirectory.FullName;
- _pollingThread = new Thread(new ThreadStart(PollingLoop));
- _pollingThread.IsBackground = true;
- _pollingThread.Name = nameof(PollingFileWatcher);
+ _pollingThread = new Thread(new ThreadStart(PollingLoop))
+ {
+ IsBackground = true,
+ Name = nameof(PollingFileWatcher)
+ };
CreateKnownFilesSnapshot();
diff --git a/src/BuiltInTools/dotnet-watch/Internal/ProcessRunner.cs b/src/BuiltInTools/dotnet-watch/Internal/ProcessRunner.cs
index d6466fee7a71..1485eadc26b8 100644
--- a/src/BuiltInTools/dotnet-watch/Internal/ProcessRunner.cs
+++ b/src/BuiltInTools/dotnet-watch/Internal/ProcessRunner.cs
@@ -182,7 +182,7 @@ public ProcessState(Process process, IReporter reporter)
// events.
//
// See the remarks here: https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.process.waitforexit#System_Diagnostics_Process_WaitForExit_System_Int32_
- if (!_process.WaitForExit(Int32.MaxValue))
+ if (!_process.WaitForExit(int.MaxValue))
{
throw new TimeoutException();
}
diff --git a/src/Cli/Microsoft.DotNet.Cli.Sln.Internal/SlnFile.cs b/src/Cli/Microsoft.DotNet.Cli.Sln.Internal/SlnFile.cs
index d01fc9ebed76..19f1ec816060 100644
--- a/src/Cli/Microsoft.DotNet.Cli.Sln.Internal/SlnFile.cs
+++ b/src/Cli/Microsoft.DotNet.Cli.Sln.Internal/SlnFile.cs
@@ -105,9 +105,11 @@ public SlnFile()
public static SlnFile Read(string file)
{
- SlnFile slnFile = new();
- slnFile.FullPath = Path.GetFullPath(file);
- slnFile._format = FileUtil.GetTextFormatInfo(file);
+ SlnFile slnFile = new()
+ {
+ FullPath = Path.GetFullPath(file),
+ _format = FileUtil.GetTextFormatInfo(file)
+ };
using (var sr = new StreamReader(new FileStream(file, FileMode.Open, FileAccess.Read)))
{
@@ -429,8 +431,10 @@ public SlnPropertySet Properties
{
if (_properties == null)
{
- _properties = new SlnPropertySet();
- _properties.ParentSection = this;
+ _properties = new SlnPropertySet
+ {
+ ParentSection = this
+ };
if (_sectionLines != null)
{
foreach (var line in _sectionLines)
@@ -504,7 +508,7 @@ private SlnSectionType ToSectionType(int curLineNum, string s)
}
throw new InvalidSolutionFormatException(
curLineNum,
- String.Format(LocalizableStrings.InvalidSectionTypeError, s));
+ string.Format(LocalizableStrings.InvalidSectionTypeError, s));
}
private string FromSectionType(bool isProjectSection, SlnSectionType type)
@@ -1066,8 +1070,11 @@ public SlnSection GetOrCreateSection(string id, SlnSectionType sectionType)
var sec = this.FirstOrDefault(s => s.Id == id);
if (sec == null)
{
- sec = new SlnSection { Id = id };
- sec.SectionType = sectionType;
+ sec = new SlnSection
+ {
+ Id = id,
+ SectionType = sectionType
+ };
Add(sec);
}
return sec;
diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/NativeMethods.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/NativeMethods.cs
index e63518ab4d6d..2467eb6166ea 100644
--- a/src/Cli/Microsoft.DotNet.Cli.Utils/NativeMethods.cs
+++ b/src/Cli/Microsoft.DotNet.Cli.Utils/NativeMethods.cs
@@ -23,26 +23,26 @@ internal enum JobObjectLimitFlags : uint
[StructLayout(LayoutKind.Sequential)]
internal struct JobObjectBasicLimitInformation
{
- public Int64 PerProcessUserTimeLimit;
- public Int64 PerJobUserTimeLimit;
+ public long PerProcessUserTimeLimit;
+ public long PerJobUserTimeLimit;
public JobObjectLimitFlags LimitFlags;
public UIntPtr MinimumWorkingSetSize;
public UIntPtr MaximumWorkingSetSize;
- public UInt32 ActiveProcessLimit;
+ public uint ActiveProcessLimit;
public UIntPtr Affinity;
- public UInt32 PriorityClass;
- public UInt32 SchedulingClass;
+ public uint PriorityClass;
+ public uint SchedulingClass;
}
[StructLayout(LayoutKind.Sequential)]
internal struct IoCounters
{
- public UInt64 ReadOperationCount;
- public UInt64 WriteOperationCount;
- public UInt64 OtherOperationCount;
- public UInt64 ReadTransferCount;
- public UInt64 WriteTransferCount;
- public UInt64 OtherTransferCount;
+ public ulong ReadOperationCount;
+ public ulong WriteOperationCount;
+ public ulong OtherOperationCount;
+ public ulong ReadTransferCount;
+ public ulong WriteTransferCount;
+ public ulong OtherTransferCount;
}
[StructLayout(LayoutKind.Sequential)]
@@ -73,7 +73,7 @@ internal struct PROCESS_BASIC_INFORMATION
internal static extern SafeWaitHandle CreateJobObjectW(IntPtr lpJobAttributes, string lpName);
[DllImport("kernel32.dll", SetLastError = true)]
- internal static extern bool SetInformationJobObject(IntPtr hJob, JobObjectInfoClass jobObjectInformationClass, IntPtr lpJobObjectInformation, UInt32 cbJobObjectInformationLength);
+ internal static extern bool SetInformationJobObject(IntPtr hJob, JobObjectInfoClass jobObjectInformationClass, IntPtr lpJobObjectInformation, uint cbJobObjectInformationLength);
[DllImport("kernel32.dll", SetLastError = true)]
internal static extern bool AssignProcessToJobObject(IntPtr hJob, IntPtr hProcess);
diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/ProcessStartInfoExtensions.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/ProcessStartInfoExtensions.cs
index 226d1f616895..4ba88507b531 100644
--- a/src/Cli/Microsoft.DotNet.Cli.Utils/ProcessStartInfoExtensions.cs
+++ b/src/Cli/Microsoft.DotNet.Cli.Utils/ProcessStartInfoExtensions.cs
@@ -39,11 +39,10 @@ public static int ExecuteAndCaptureOutput(this ProcessStartInfo startInfo, out s
var process = new Process
{
- StartInfo = startInfo
+ StartInfo = startInfo,
+ EnableRaisingEvents = true
};
- process.EnableRaisingEvents = true;
-
using (var reaper = new ProcessReaper(process))
{
process.Start();
diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/RuntimeEnvironment.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/RuntimeEnvironment.cs
index e819bab18e11..31dfe90dad6d 100644
--- a/src/Cli/Microsoft.DotNet.Cli.Utils/RuntimeEnvironment.cs
+++ b/src/Cli/Microsoft.DotNet.Cli.Utils/RuntimeEnvironment.cs
@@ -82,7 +82,7 @@ private static string GetFreeBSDVersion()
// This is same as sysctl kern.version
// FreeBSD 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 01:43:23 UTC 2016 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC
// What we want is major release as minor releases should be compatible.
- String version = RuntimeInformation.OSDescription;
+ string version = RuntimeInformation.OSDescription;
try
{
// second token up to first dot
diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/UILanguageOverride.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/UILanguageOverride.cs
index 9893d5545ad3..59e37dc038dd 100644
--- a/src/Cli/Microsoft.DotNet.Cli.Utils/UILanguageOverride.cs
+++ b/src/Cli/Microsoft.DotNet.Cli.Utils/UILanguageOverride.cs
@@ -126,7 +126,7 @@ private static bool CurrentPlatformOfficiallySupportsUTF8Encoding()
private static bool ForceUniversalEncodingOptInEnabled()
{
- return String.Equals(Environment.GetEnvironmentVariable("DOTNET_CLI_FORCE_UTF8_ENCODING"), "true", StringComparison.OrdinalIgnoreCase);
+ return string.Equals(Environment.GetEnvironmentVariable("DOTNET_CLI_FORCE_UTF8_ENCODING"), "true", StringComparison.OrdinalIgnoreCase);
}
}
}
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/TemplateCommand.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/TemplateCommand.cs
index a3ecf2fc2a50..8f5a3e489ce4 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/TemplateCommand.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/TemplateCommand.cs
@@ -103,9 +103,9 @@ public TemplateCommand(
AllowScriptsOption = new CliOption("--allow-scripts")
{
Description = SymbolStrings.TemplateCommand_Option_AllowScripts,
- Arity = new ArgumentArity(1, 1)
+ Arity = new ArgumentArity(1, 1),
+ DefaultValueFactory = (_) => AllowRunScripts.Prompt
};
- AllowScriptsOption.DefaultValueFactory = (_) => AllowRunScripts.Prompt;
Options.Add(AllowScriptsOption);
}
diff --git a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/TemplateResult.cs b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/TemplateResult.cs
index 00d400b43e78..5e7ad30d1899 100644
--- a/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/TemplateResult.cs
+++ b/src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/TemplateResult.cs
@@ -39,10 +39,12 @@ private TemplateResult(TemplateCommand templateCommand, ParseResult parseResult)
internal static TemplateResult FromParseResult(TemplateCommand templateCommand, ParseResult parseResult)
{
- TemplateResult result = new(templateCommand, parseResult);
- result.IsLanguageMatch = templateCommand.LanguageOption == null || !parseResult.HasErrorFor(templateCommand.LanguageOption, out _);
- result.IsTypeMatch = templateCommand.TypeOption == null || !parseResult.HasErrorFor(templateCommand.TypeOption, out _);
- result.IsBaselineMatch = templateCommand.BaselineOption == null || !parseResult.HasErrorFor(templateCommand.BaselineOption, out _);
+ TemplateResult result = new(templateCommand, parseResult)
+ {
+ IsLanguageMatch = templateCommand.LanguageOption == null || !parseResult.HasErrorFor(templateCommand.LanguageOption, out _),
+ IsTypeMatch = templateCommand.TypeOption == null || !parseResult.HasErrorFor(templateCommand.TypeOption, out _),
+ IsBaselineMatch = templateCommand.BaselineOption == null || !parseResult.HasErrorFor(templateCommand.BaselineOption, out _)
+ };
if (templateCommand.LanguageOption != null && result.IsTemplateMatch)
{
diff --git a/src/Cli/dotnet/Installer/Windows/InstallClientElevationContext.cs b/src/Cli/dotnet/Installer/Windows/InstallClientElevationContext.cs
index 65c24dfbe79c..d6002a9731e5 100644
--- a/src/Cli/dotnet/Installer/Windows/InstallClientElevationContext.cs
+++ b/src/Cli/dotnet/Installer/Windows/InstallClientElevationContext.cs
@@ -75,7 +75,7 @@ public override void Elevate()
}
}
- private void ServerExited(Object sender, EventArgs e)
+ private void ServerExited(object sender, EventArgs e)
{
_log?.LogMessage($"Elevated command instance has exited.");
}
diff --git a/src/Cli/dotnet/ReleasePropertyProjectLocator.cs b/src/Cli/dotnet/ReleasePropertyProjectLocator.cs
index 95cac2847d05..079d41c4f60d 100644
--- a/src/Cli/dotnet/ReleasePropertyProjectLocator.cs
+++ b/src/Cli/dotnet/ReleasePropertyProjectLocator.cs
@@ -62,7 +62,7 @@ public IEnumerable GetCustomDefaultConfigurationValueIfSpecified()
// Setup
Debug.Assert(_propertyToCheck == MSBuildPropertyNames.PUBLISH_RELEASE || _propertyToCheck == MSBuildPropertyNames.PACK_RELEASE, "Only PackRelease or PublishRelease are currently expected.");
var nothing = Enumerable.Empty();
- if (String.Equals(Environment.GetEnvironmentVariable(EnvironmentVariableNames.DISABLE_PUBLISH_AND_PACK_RELEASE), "true", StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(Environment.GetEnvironmentVariable(EnvironmentVariableNames.DISABLE_PUBLISH_AND_PACK_RELEASE), "true", StringComparison.OrdinalIgnoreCase))
{
return nothing;
}
@@ -160,7 +160,7 @@ public IEnumerable GetCustomDefaultConfigurationValueIfSpecified()
HashSet configValues = new();
object projectDataLock = new();
- if (String.Equals(Environment.GetEnvironmentVariable(EnvironmentVariableNames.DOTNET_CLI_LAZY_PUBLISH_AND_PACK_RELEASE_FOR_SOLUTIONS), "true", StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(Environment.GetEnvironmentVariable(EnvironmentVariableNames.DOTNET_CLI_LAZY_PUBLISH_AND_PACK_RELEASE_FOR_SOLUTIONS), "true", StringComparison.OrdinalIgnoreCase))
{
// Evaluate only one project for speed if this environment variable is used. Will break more customers if enabled (adding 8.0 project to SLN with other project TFMs with no Publish or PackRelease.)
return GetSingleProjectFromSolution(sln, globalProps);
@@ -197,7 +197,7 @@ public IEnumerable GetCustomDefaultConfigurationValueIfSpecified()
// 1) This error should not be thrown in VS because it is part of the SDK CLI code
// 2) If PublishRelease or PackRelease is disabled via opt out, or Configuration is specified, we won't get to this code, so we won't error
// 3) This code only gets hit if we are in a solution publish setting, so we don't need to worry about it failing other publish scenarios
- throw new GracefulException(Strings.SolutionProjectConfigurationsConflict, _propertyToCheck, String.Join("\n", (configuredProjects).Select(x => x.FullPath)));
+ throw new GracefulException(Strings.SolutionProjectConfigurationsConflict, _propertyToCheck, string.Join("\n", (configuredProjects).Select(x => x.FullPath)));
}
return configuredProjects.FirstOrDefault();
}
diff --git a/src/Cli/dotnet/SlnFileExtensions.cs b/src/Cli/dotnet/SlnFileExtensions.cs
index 598367215db1..3f601caee8c2 100644
--- a/src/Cli/dotnet/SlnFileExtensions.cs
+++ b/src/Cli/dotnet/SlnFileExtensions.cs
@@ -205,7 +205,7 @@ private static string GetMatchingProjectKey(IDictionary projectK
return projectKey;
}
- var keyWithoutWhitespace = String.Concat(solutionKey.Where(c => !Char.IsWhiteSpace(c)));
+ var keyWithoutWhitespace = string.Concat(solutionKey.Where(c => !char.IsWhiteSpace(c)));
if (projectKeys.TryGetValue(keyWithoutWhitespace, out projectKey))
{
return projectKey;
diff --git a/src/Cli/dotnet/Telemetry/Telemetry.cs b/src/Cli/dotnet/Telemetry/Telemetry.cs
index 61054e617832..96f7491f65c9 100644
--- a/src/Cli/dotnet/Telemetry/Telemetry.cs
+++ b/src/Cli/dotnet/Telemetry/Telemetry.cs
@@ -136,8 +136,10 @@ private void InitializeTelemetry()
{
try
{
- var persistenceChannel = new PersistenceChannel.PersistenceChannel(sendersCount: _senderCount);
- persistenceChannel.SendingInterval = TimeSpan.FromMilliseconds(1);
+ var persistenceChannel = new PersistenceChannel.PersistenceChannel(sendersCount: _senderCount)
+ {
+ SendingInterval = TimeSpan.FromMilliseconds(1)
+ };
var config = TelemetryConfiguration.CreateDefault();
config.TelemetryChannel = persistenceChannel;
diff --git a/src/Cli/dotnet/ToolManifest/ToolManifestEditor.cs b/src/Cli/dotnet/ToolManifest/ToolManifestEditor.cs
index 8827abb7046c..6147cf89700c 100644
--- a/src/Cli/dotnet/ToolManifest/ToolManifestEditor.cs
+++ b/src/Cli/dotnet/ToolManifest/ToolManifestEditor.cs
@@ -165,8 +165,10 @@ private SerializableLocalToolsManifest DeserializeLocalToolsManifest(FilePath po
foreach (var toolJson in tools.EnumerateObject())
{
- var serializableLocalToolSinglePackage = new SerializableLocalToolSinglePackage();
- serializableLocalToolSinglePackage.PackageId = toolJson.Name;
+ var serializableLocalToolSinglePackage = new SerializableLocalToolSinglePackage
+ {
+ PackageId = toolJson.Name
+ };
if (toolJson.Value.TryGetStringValue(JsonPropertyVersion, out var versionJson))
{
serializableLocalToolSinglePackage.Version = versionJson;
diff --git a/src/Cli/dotnet/commands/InstallingWorkloadCommand.cs b/src/Cli/dotnet/commands/InstallingWorkloadCommand.cs
index e5f56d966217..ba98481c5c33 100644
--- a/src/Cli/dotnet/commands/InstallingWorkloadCommand.cs
+++ b/src/Cli/dotnet/commands/InstallingWorkloadCommand.cs
@@ -82,12 +82,14 @@ public InstallingWorkloadCommand(
_workloadManifestUpdaterFromConstructor = workloadManifestUpdater;
}
- protected async Task> GetDownloads(IEnumerable workloadIds, bool skipManifestUpdate, bool includePreview, string downloadFolder = null)
+ protected async Task> GetDownloads(IEnumerable workloadIds, bool skipManifestUpdate, bool includePreview, string downloadFolder = null,
+ IReporter reporter = null, INuGetPackageDownloader packageDownloader = null)
{
- List ret = new();
+ reporter ??= Reporter;
+ packageDownloader ??= PackageDownloader;
+ List ret = new();
DirectoryPath? tempPath = null;
-
try
{
if (!skipManifestUpdate)
@@ -109,7 +111,7 @@ protected async Task> GetDownloads(IEnumerable> GetDownloads(IEnumerable> GetDownloads(IEnumerable("--version"));
command.Options.Add(new CliOption("--verbosity", "-v"));
@@ -167,8 +168,10 @@ private static CliCommand GetTrustCommand()
};
CliCommand CertificateCommand() {
- CliOption algorithm = new("--algorithm");
- algorithm.DefaultValueFactory = (_argResult) => "SHA256";
+ CliOption algorithm = new("--algorithm")
+ {
+ DefaultValueFactory = (_argResult) => "SHA256"
+ };
algorithm.AcceptOnlyFromAmong("SHA256", "SHA384", "SHA512");
return new CliCommand("certificate") {
diff --git a/src/Cli/dotnet/commands/dotnet-run/LaunchSettings/LaunchSettingsManager.cs b/src/Cli/dotnet/commands/dotnet-run/LaunchSettings/LaunchSettingsManager.cs
index 30bd40a2565b..9e4aa74970e1 100644
--- a/src/Cli/dotnet/commands/dotnet-run/LaunchSettings/LaunchSettingsManager.cs
+++ b/src/Cli/dotnet/commands/dotnet-run/LaunchSettings/LaunchSettingsManager.cs
@@ -61,7 +61,7 @@ public static LaunchSettingsApplyResult TryApplyLaunchSettings(string launchSett
if (caseInsensitiveProfileMatches.Count() > 1)
{
throw new GracefulException(LocalizableStrings.DuplicateCaseInsensitiveLaunchProfileNames,
- String.Join(",\n", caseInsensitiveProfileMatches.Select(p => $"\t{p.Name}").ToArray()));
+ string.Join(",\n", caseInsensitiveProfileMatches.Select(p => $"\t{p.Name}").ToArray()));
}
else if (!caseInsensitiveProfileMatches.Any())
{
diff --git a/src/Cli/dotnet/commands/dotnet-run/LaunchSettings/ProjectLaunchSettingsProvider.cs b/src/Cli/dotnet/commands/dotnet-run/LaunchSettings/ProjectLaunchSettingsProvider.cs
index 4f35b2e504c9..80c2035cc056 100644
--- a/src/Cli/dotnet/commands/dotnet-run/LaunchSettings/ProjectLaunchSettingsProvider.cs
+++ b/src/Cli/dotnet/commands/dotnet-run/LaunchSettings/ProjectLaunchSettingsProvider.cs
@@ -15,8 +15,10 @@ internal class ProjectLaunchSettingsProvider : ILaunchSettingsProvider
public LaunchSettingsApplyResult TryGetLaunchSettings(string? launchProfileName, JsonElement model)
{
- var config = new ProjectLaunchSettingsModel();
- config.LaunchProfileName = launchProfileName;
+ var config = new ProjectLaunchSettingsModel
+ {
+ LaunchProfileName = launchProfileName
+ };
foreach (var property in model.EnumerateObject())
{
diff --git a/src/Cli/dotnet/commands/dotnet-run/RunCommand.cs b/src/Cli/dotnet/commands/dotnet-run/RunCommand.cs
index 88a279e89575..2085fa156687 100644
--- a/src/Cli/dotnet/commands/dotnet-run/RunCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-run/RunCommand.cs
@@ -69,7 +69,7 @@ public int Execute()
//NOTE: MSBuild variables are not expanded like they are in VS
targetCommand.EnvironmentVariable(entry.Key, value);
}
- if (String.IsNullOrEmpty(targetCommand.CommandArgs) && launchSettings.CommandLineArgs != null)
+ if (string.IsNullOrEmpty(targetCommand.CommandArgs) && launchSettings.CommandLineArgs != null)
{
targetCommand.SetCommandArgs(launchSettings.CommandLineArgs);
}
diff --git a/src/Cli/dotnet/commands/dotnet-test/Program.cs b/src/Cli/dotnet/commands/dotnet-test/Program.cs
index f50519454c8f..8cfc5a3600fc 100644
--- a/src/Cli/dotnet/commands/dotnet-test/Program.cs
+++ b/src/Cli/dotnet/commands/dotnet-test/Program.cs
@@ -141,7 +141,7 @@ private static TestCommand FromParseResult(ParseResult result, string[] settings
result.OptionValuesToBeForwarded(TestCommandParser.GetCommand()) // all msbuild-recognized tokens
.Concat(unMatchedNonSettingsArgs); // all tokens that the test-parser doesn't explicitly track (minus the settings tokens)
- VSTestTrace.SafeWriteTrace(() => $"MSBuild args from forwarded options: {String.Join(", ", parsedArgs)}");
+ VSTestTrace.SafeWriteTrace(() => $"MSBuild args from forwarded options: {string.Join(", ", parsedArgs)}");
msbuildArgs.AddRange(parsedArgs);
if (settings.Any())
diff --git a/src/Cli/dotnet/commands/dotnet-test/TestCommandParser.cs b/src/Cli/dotnet/commands/dotnet-test/TestCommandParser.cs
index 33d8e9437480..12a042e399d8 100644
--- a/src/Cli/dotnet/commands/dotnet-test/TestCommandParser.cs
+++ b/src/Cli/dotnet/commands/dotnet-test/TestCommandParser.cs
@@ -159,8 +159,10 @@ public static CliCommand GetCommand()
private static CliCommand ConstructCommand()
{
- DocumentedCommand command = new("test", DocsLink, LocalizableStrings.AppFullName);
- command.TreatUnmatchedTokensAsErrors = false;
+ DocumentedCommand command = new("test", DocsLink, LocalizableStrings.AppFullName)
+ {
+ TreatUnmatchedTokensAsErrors = false
+ };
// We are on purpose not capturing the solution, project or directory here. We want to pass it to the
// MSBuild command so we are letting it flow.
diff --git a/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallCommandLowLevelErrorConverter.cs b/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallCommandLowLevelErrorConverter.cs
index c7c0e16e3a11..634e20571dd8 100644
--- a/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallCommandLowLevelErrorConverter.cs
+++ b/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallCommandLowLevelErrorConverter.cs
@@ -15,7 +15,7 @@ public static IEnumerable GetUserFacingMessages(Exception ex, PackageId
{
userFacingMessages = new[]
{
- String.Format(
+ string.Format(
CommonLocalizableStrings.FailedToUninstallToolPackage,
packageId,
ex.Message),
diff --git a/src/Cli/dotnet/commands/dotnet-vstest/VSTestCommandParser.cs b/src/Cli/dotnet/commands/dotnet-vstest/VSTestCommandParser.cs
index 36f41bd6026e..3309cdc8385e 100644
--- a/src/Cli/dotnet/commands/dotnet-vstest/VSTestCommandParser.cs
+++ b/src/Cli/dotnet/commands/dotnet-vstest/VSTestCommandParser.cs
@@ -19,9 +19,10 @@ public static CliCommand GetCommand()
private static CliCommand ConstructCommand()
{
- DocumentedCommand command = new("vstest", DocsLink);
-
- command.TreatUnmatchedTokensAsErrors = false;
+ DocumentedCommand command = new("vstest", DocsLink)
+ {
+ TreatUnmatchedTokensAsErrors = false
+ };
command.Options.Add(CommonOptions.TestPlatformOption);
command.Options.Add(CommonOptions.TestFrameworkOption);
diff --git a/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandBase.cs b/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandBase.cs
index 33ed59120212..d1e46e09bc91 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandBase.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandBase.cs
@@ -71,6 +71,8 @@ protected bool VerifySignatures
get;
}
+ protected bool IsPackageDownloaderProvided { get; }
+
///
/// Initializes a new instance.
///
@@ -107,10 +109,12 @@ public WorkloadCommandBase(
TempPackagesDirectory = new DirectoryPath(Path.Combine(TempDirectoryPath, "dotnet-sdk-advertising-temp"));
- PackageDownloader = nugetPackageDownloader ?? new NuGetPackageDownloader(TempPackagesDirectory,
+ IsPackageDownloaderProvided = nugetPackageDownloader != null;
+ PackageDownloader = IsPackageDownloaderProvided ? nugetPackageDownloader : new NuGetPackageDownloader(TempPackagesDirectory,
filePermissionSetter: null,
new FirstPartyNuGetPackageSigningVerifier(),
nugetLogger,
+ Reporter,
restoreActionConfig: RestoreActionConfiguration,
verifySignatures: VerifySignatures);
}
diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerClient.cs b/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerClient.cs
index f87006fb4c1e..d5c944d023c7 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerClient.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerClient.cs
@@ -283,7 +283,7 @@ private void RemoveWorkloadPacks(List packsToRemove, Directo
{
Log?.LogMessage($"ProductCode mismatch! Cached package: {msi.ProductCode}, pack record: {record.ProductCode}.");
string logFile = GetMsiLogName(record, InstallAction.Uninstall);
- uint error = ExecuteWithProgress(String.Format(LocalizableStrings.MsiProgressUninstall, id), () => UninstallMsi(record.ProductCode, logFile));
+ uint error = ExecuteWithProgress(string.Format(LocalizableStrings.MsiProgressUninstall, id), () => UninstallMsi(record.ProductCode, logFile));
ExitOnError(error, $"Failed to uninstall {msi.MsiPath}.");
}
else
@@ -586,7 +586,7 @@ public async Task ExtractManifestAsync(string nupkgPath, string targetPath)
string packageDataPath = Path.Combine(extractionPath, "data");
if (!Cache.TryGetMsiPathFromPackageData(packageDataPath, out string msiPath, out _))
{
- throw new FileNotFoundException(String.Format(LocalizableStrings.ManifestMsiNotFoundInNuGetPackage, extractionPath));
+ throw new FileNotFoundException(string.Format(LocalizableStrings.ManifestMsiNotFoundInNuGetPackage, extractionPath));
}
string msiExtractionPath = Path.Combine(extractionPath, "msi");
@@ -604,7 +604,7 @@ public async Task ExtractManifestAsync(string nupkgPath, string targetPath)
if (result != Error.SUCCESS)
{
Log?.LogMessage($"ExtractManifestAsync: Admin install failed: {result}");
- throw new GracefulException(String.Format(LocalizableStrings.FailedToExtractMsi, msiPath));
+ throw new GracefulException(string.Format(LocalizableStrings.FailedToExtractMsi, msiPath));
}
}
@@ -619,7 +619,7 @@ public async Task ExtractManifestAsync(string nupkgPath, string targetPath)
if (manifestFolder == null)
{
- throw new GracefulException(String.Format(LocalizableStrings.ExpectedSingleManifest, nupkgPath));
+ throw new GracefulException(string.Format(LocalizableStrings.ExpectedSingleManifest, nupkgPath));
}
FileAccessRetrier.RetryOnMoveAccessFailure(() => DirectoryPath.MoveDirectory(manifestFolder, targetPath));
@@ -930,17 +930,17 @@ private void ExecutePackage(MsiPayload msi, InstallAction action, string display
case InstallAction.MinorUpdate:
case InstallAction.Install:
case InstallAction.MajorUpgrade:
- error = ExecuteWithProgress(String.Format(LocalizableStrings.MsiProgressInstall, name), () => InstallMsi(msi.MsiPath, logFile));
+ error = ExecuteWithProgress(string.Format(LocalizableStrings.MsiProgressInstall, name), () => InstallMsi(msi.MsiPath, logFile));
ExitOnError(error, $"Failed to install {msi.Payload}.");
break;
case InstallAction.Repair:
- error = ExecuteWithProgress(String.Format(LocalizableStrings.MsiProgressRepair, name), () => RepairMsi(msi.ProductCode, logFile));
+ error = ExecuteWithProgress(string.Format(LocalizableStrings.MsiProgressRepair, name), () => RepairMsi(msi.ProductCode, logFile));
ExitOnError(error, $"Failed to repair {msi.Payload}.");
break;
case InstallAction.Uninstall:
- error = ExecuteWithProgress(String.Format(LocalizableStrings.MsiProgressUninstall, name), () => UninstallMsi(msi.ProductCode, logFile));
+ error = ExecuteWithProgress(string.Format(LocalizableStrings.MsiProgressUninstall, name), () => UninstallMsi(msi.ProductCode, logFile));
ExitOnError(error, $"Failed to remove {msi.Payload}.");
break;
diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerServer.cs b/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerServer.cs
index 7b5311140fca..ed156cfbf058 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerServer.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerServer.cs
@@ -133,7 +133,7 @@ public static NetSdkMsiInstallerServer Create(bool verifySignatures)
if ((ParentProcess == null) || (ParentProcess.StartTime > CurrentProcess.StartTime) ||
!string.Equals(ParentProcess.MainModule.FileName, Environment.ProcessPath, StringComparison.OrdinalIgnoreCase))
{
- throw new SecurityException(String.Format(LocalizableStrings.NoTrustWithParentPID, ParentProcess?.Id));
+ throw new SecurityException(string.Format(LocalizableStrings.NoTrustWithParentPID, ParentProcess?.Id));
}
// Configure pipe DACLs
diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/NullReporter.cs b/src/Cli/dotnet/commands/dotnet-workload/install/NullReporter.cs
index 4a72ea054450..15c7fe8ef83d 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/install/NullReporter.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/install/NullReporter.cs
@@ -14,5 +14,7 @@ public void WriteLine(string message) { }
public void WriteLine() { }
public void WriteLine(string format, params object?[] args) => WriteLine(string.Format(format, args));
+
+ public static NullReporter Instance { get; } = new NullReporter();
}
}
diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallCommand.cs b/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallCommand.cs
index d56bdd65351a..7b31859cb7cc 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallCommand.cs
@@ -9,6 +9,7 @@
using Microsoft.DotNet.ToolPackage;
using Microsoft.Extensions.EnvironmentAbstractions;
using Microsoft.NET.Sdk.WorkloadManifestReader;
+using NuGet.Common;
using NuGet.Versioning;
using static Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver;
@@ -38,13 +39,14 @@ public WorkloadInstallCommand(
{
_skipManifestUpdate = parseResult.GetValue(WorkloadInstallCommandParser.SkipManifestUpdateOption);
_workloadIds = workloadIds ?? parseResult.GetValue(WorkloadInstallCommandParser.WorkloadIdArgument).ToList().AsReadOnly();
+ var resolvedReporter = _printDownloadLinkOnly ? NullReporter.Instance : Reporter;
_workloadInstaller = _workloadInstallerFromConstructor ??
- WorkloadInstallerFactory.GetWorkloadInstaller(Reporter, _sdkFeatureBand,
+ WorkloadInstallerFactory.GetWorkloadInstaller(resolvedReporter, _sdkFeatureBand,
workloadResolver ?? _workloadResolver, Verbosity, _userProfileDir, VerifySignatures, PackageDownloader, _dotnetPath, TempDirectoryPath,
_packageSourceLocation, RestoreActionConfiguration, elevationRequired: !_printDownloadLinkOnly && string.IsNullOrWhiteSpace(_downloadToCacheOption));
- _workloadManifestUpdater = _workloadManifestUpdaterFromConstructor ?? new WorkloadManifestUpdater(Reporter, workloadResolver ?? _workloadResolver, PackageDownloader, _userProfileDir, TempDirectoryPath,
+ _workloadManifestUpdater = _workloadManifestUpdaterFromConstructor ?? new WorkloadManifestUpdater(resolvedReporter, workloadResolver ?? _workloadResolver, PackageDownloader, _userProfileDir, TempDirectoryPath,
_workloadInstaller.GetWorkloadInstallationRecordRepository(), _workloadInstaller, _packageSourceLocation, displayManifestUpdates: Verbosity.IsDetailedOrDiagnostic());
ValidateWorkloadIdsInput();
@@ -70,7 +72,14 @@ public override int Execute()
bool usedRollback = !string.IsNullOrWhiteSpace(_fromRollbackDefinition);
if (_printDownloadLinkOnly)
{
- Reporter.WriteLine(string.Format(LocalizableStrings.ResolvingPackageUrls, string.Join(", ", _workloadIds)));
+ var packageDownloader = IsPackageDownloaderProvided ? PackageDownloader : new NuGetPackageDownloader(
+ TempPackagesDirectory,
+ filePermissionSetter: null,
+ new FirstPartyNuGetPackageSigningVerifier(),
+ new NullLogger(),
+ NullReporter.Instance,
+ restoreActionConfig: RestoreActionConfiguration,
+ verifySignatures: VerifySignatures);
// Take the union of the currently installed workloads and the ones that are being requested. This is so that if there are updates to the manifests
// which require new packs for currently installed workloads, those packs will be downloaded.
@@ -78,11 +87,9 @@ public override int Execute()
var existingWorkloads = GetInstalledWorkloads(false);
var workloadsToDownload = existingWorkloads.Union(_workloadIds.Select(id => new WorkloadId(id))).ToList();
- var packageUrls = GetPackageDownloadUrlsAsync(workloadsToDownload, _skipManifestUpdate, _includePreviews).GetAwaiter().GetResult();
+ var packageUrls = GetPackageDownloadUrlsAsync(workloadsToDownload, _skipManifestUpdate, _includePreviews, NullReporter.Instance, packageDownloader).GetAwaiter().GetResult();
- Reporter.WriteLine("==allPackageLinksJsonOutputStart==");
Reporter.WriteLine(JsonSerializer.Serialize(packageUrls, new JsonSerializerOptions() { WriteIndented = true }));
- Reporter.WriteLine("==allPackageLinksJsonOutputEnd==");
}
else if (!string.IsNullOrWhiteSpace(_downloadToCacheOption))
{
@@ -226,17 +233,19 @@ private void InstallWorkloadsWithInstallRecord(
.DeleteWorkloadInstallationRecord(workloadId, sdkFeatureBand);
}
});
-
}
- private async Task> GetPackageDownloadUrlsAsync(IEnumerable workloadIds, bool skipManifestUpdate, bool includePreview)
+ private async Task> GetPackageDownloadUrlsAsync(IEnumerable workloadIds, bool skipManifestUpdate, bool includePreview,
+ IReporter reporter = null, INuGetPackageDownloader packageDownloader = null)
{
- var downloads = await GetDownloads(workloadIds, skipManifestUpdate, includePreview);
+ reporter ??= Reporter;
+ packageDownloader ??= PackageDownloader;
+ var downloads = await GetDownloads(workloadIds, skipManifestUpdate, includePreview, reporter: reporter, packageDownloader: packageDownloader);
var urls = new List();
foreach (var download in downloads)
{
- urls.Add(await PackageDownloader.GetPackageUrl(new PackageId(download.NuGetPackageId), new NuGetVersion(download.NuGetPackageVersion), _packageSourceLocation));
+ urls.Add(await packageDownloader.GetPackageUrl(new PackageId(download.NuGetPackageId), new NuGetVersion(download.NuGetPackageVersion), _packageSourceLocation));
}
return urls;
diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadManifestUpdater.cs b/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadManifestUpdater.cs
index 08505b418c98..7e6a08c5447d 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadManifestUpdater.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadManifestUpdater.cs
@@ -470,7 +470,7 @@ private bool BackgroundUpdatesAreDisabled() =>
private static string GetAdvertisingWorkloadsFilePath(string userProfileDir, SdkFeatureBand featureBand) => Path.Combine(userProfileDir, $".workloadAdvertisingUpdates{featureBand}");
- private async Task GetOnlinePackagePath(SdkFeatureBand sdkFeatureBand, ManifestId manifestId, bool includePreviews)
+ private async Task GetOnlinePackagePath(SdkFeatureBand sdkFeatureBand, ManifestId manifestId, bool includePreviews)
{
string packagePath = await _nugetPackageDownloader.DownloadPackageAsync(
_workloadManifestInstaller.GetManifestPackageId(manifestId, sdkFeatureBand),
diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadResolverFactory.cs b/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadResolverFactory.cs
index 19c9415eab89..f67b419aae87 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadResolverFactory.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadResolverFactory.cs
@@ -35,9 +35,10 @@ public class CreationResult
public static CreationResult Create(CreationParameters parameters)
{
- var result = new CreationResult();
-
- result.InstalledSdkVersion = new ReleaseVersion(parameters.VersionForTesting ?? Product.Version);
+ var result = new CreationResult
+ {
+ InstalledSdkVersion = new ReleaseVersion(parameters.VersionForTesting ?? Product.Version)
+ };
bool manifestsNeedValidation;
if (string.IsNullOrEmpty(parameters.SdkVersionFromOption))
diff --git a/src/Cli/dotnet/commands/dotnet-workload/list/WorkloadListCommand.cs b/src/Cli/dotnet/commands/dotnet-workload/list/WorkloadListCommand.cs
index 42fb65445dd7..13f96f6a9880 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/list/WorkloadListCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/list/WorkloadListCommand.cs
@@ -35,12 +35,15 @@ public WorkloadListCommand(
IWorkloadResolver workloadResolver = null
) : base(parseResult, CommonOptions.HiddenVerbosityOption, reporter, tempDirPath, nugetPackageDownloader)
{
+ _machineReadableOption = parseResult.GetValue(WorkloadListCommandParser.MachineReadableOption);
+
+ var resolvedReporter = _machineReadableOption ? NullReporter.Instance : Reporter;
_workloadListHelper = new WorkloadInfoHelper(
parseResult.HasOption(SharedOptions.InteractiveOption),
Verbosity,
parseResult?.GetValue(WorkloadListCommandParser.VersionOption) ?? null,
VerifySignatures,
- Reporter,
+ resolvedReporter,
workloadRecordRepo,
currentSdkVersion,
dotnetDir,
@@ -48,12 +51,10 @@ public WorkloadListCommand(
workloadResolver
);
- _machineReadableOption = parseResult.GetValue(WorkloadListCommandParser.MachineReadableOption);
-
_includePreviews = parseResult.GetValue(WorkloadListCommandParser.IncludePreviewsOption);
string userProfileDir1 = userProfileDir ?? CliFolderPathCalculator.DotnetUserProfileFolderPath;
- _workloadManifestUpdater = workloadManifestUpdater ?? new WorkloadManifestUpdater(Reporter,
+ _workloadManifestUpdater = workloadManifestUpdater ?? new WorkloadManifestUpdater(resolvedReporter,
_workloadListHelper.WorkloadResolver, PackageDownloader, userProfileDir1, TempDirectoryPath, _workloadListHelper.WorkloadRecordRepo, _workloadListHelper.Installer);
}
@@ -69,11 +70,7 @@ public override int Execute()
ListOutput listOutput = new(installedList.Select(id => id.ToString()).ToArray(),
updateAvailable);
- Reporter.WriteLine("==workloadListJsonOutputStart==");
- Reporter.WriteLine(
- JsonSerializer.Serialize(listOutput,
- new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }));
- Reporter.WriteLine("==workloadListJsonOutputEnd==");
+ Reporter.WriteLine(JsonSerializer.Serialize(listOutput, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }));
}
else
{
diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommand.cs b/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommand.cs
index 48881631ecd8..d534cfac8e0d 100644
--- a/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommand.cs
+++ b/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommand.cs
@@ -10,6 +10,7 @@
using Microsoft.DotNet.Workloads.Workload.Install;
using Microsoft.Extensions.EnvironmentAbstractions;
using Microsoft.NET.Sdk.WorkloadManifestReader;
+using NuGet.Common;
using NuGet.Versioning;
namespace Microsoft.DotNet.Workloads.Workload.Update
@@ -40,13 +41,14 @@ public WorkloadUpdateCommand(
_fromPreviousSdk = parseResult.GetValue(WorkloadUpdateCommandParser.FromPreviousSdkOption);
_adManifestOnlyOption = parseResult.GetValue(WorkloadUpdateCommandParser.AdManifestOnlyOption);
_printRollbackDefinitionOnly = parseResult.GetValue(WorkloadUpdateCommandParser.PrintRollbackOption);
+ var resolvedReporter = _printDownloadLinkOnly || _printRollbackDefinitionOnly ? NullReporter.Instance : Reporter;
- _workloadInstaller = _workloadInstallerFromConstructor ?? WorkloadInstallerFactory.GetWorkloadInstaller(Reporter,
+ _workloadInstaller = _workloadInstallerFromConstructor ?? WorkloadInstallerFactory.GetWorkloadInstaller(resolvedReporter,
_sdkFeatureBand, workloadResolver ?? _workloadResolver, Verbosity, _userProfileDir, VerifySignatures, PackageDownloader,
_dotnetPath, TempDirectoryPath, packageSourceLocation: _packageSourceLocation, RestoreActionConfiguration,
elevationRequired: !_printDownloadLinkOnly && !_printRollbackDefinitionOnly && string.IsNullOrWhiteSpace(_downloadToCacheOption));
- _workloadManifestUpdater = _workloadManifestUpdaterFromConstructor ?? new WorkloadManifestUpdater(Reporter, workloadResolver ?? _workloadResolver, PackageDownloader, _userProfileDir, TempDirectoryPath,
+ _workloadManifestUpdater = _workloadManifestUpdaterFromConstructor ?? new WorkloadManifestUpdater(resolvedReporter, workloadResolver ?? _workloadResolver, PackageDownloader, _userProfileDir, TempDirectoryPath,
_workloadInstaller.GetWorkloadInstallationRecordRepository(), _workloadInstaller, _packageSourceLocation, sdkFeatureBand: _sdkFeatureBand);
}
@@ -65,10 +67,17 @@ public override int Execute()
}
else if (_printDownloadLinkOnly)
{
- var packageUrls = GetUpdatablePackageUrlsAsync(_includePreviews).GetAwaiter().GetResult();
- Reporter.WriteLine("==allPackageLinksJsonOutputStart==");
+ var packageDownloader = IsPackageDownloaderProvided ? PackageDownloader : new NuGetPackageDownloader(
+ TempPackagesDirectory,
+ filePermissionSetter: null,
+ new FirstPartyNuGetPackageSigningVerifier(),
+ new NullLogger(),
+ NullReporter.Instance,
+ restoreActionConfig: RestoreActionConfiguration,
+ verifySignatures: VerifySignatures);
+
+ var packageUrls = GetUpdatablePackageUrlsAsync(_includePreviews, NullReporter.Instance, packageDownloader).GetAwaiter().GetResult();
Reporter.WriteLine(JsonSerializer.Serialize(packageUrls, new JsonSerializerOptions() { WriteIndented = true }));
- Reporter.WriteLine("==allPackageLinksJsonOutputEnd==");
}
else if (_adManifestOnlyOption)
{
@@ -79,10 +88,7 @@ public override int Execute()
else if (_printRollbackDefinitionOnly)
{
var workloadSet = WorkloadSet.FromManifests(_workloadResolver.GetInstalledManifests());
-
- Reporter.WriteLine("==workloadRollbackDefinitionJsonOutputStart==");
Reporter.WriteLine(workloadSet.ToJson());
- Reporter.WriteLine("==workloadRollbackDefinitionJsonOutputEnd==");
}
else
{
@@ -130,16 +136,17 @@ private void UpdateWorkloadsWithInstallRecord(
DirectoryPath? offlineCache = null)
{
- var transaction = new CliTransaction();
-
- transaction.RollbackStarted = () =>
- {
- Reporter.WriteLine(LocalizableStrings.RollingBackInstall);
- };
- // Don't hide the original error if roll back fails, but do log the rollback failure
- transaction.RollbackFailed = ex =>
+ var transaction = new CliTransaction
{
- Reporter.WriteLine(string.Format(LocalizableStrings.RollBackFailedMessage, ex.Message));
+ RollbackStarted = () =>
+ {
+ Reporter.WriteLine(LocalizableStrings.RollingBackInstall);
+ },
+ // Don't hide the original error if roll back fails, but do log the rollback failure
+ RollbackFailed = ex =>
+ {
+ Reporter.WriteLine(string.Format(LocalizableStrings.RollBackFailedMessage, ex.Message));
+ }
};
transaction.Run(
@@ -169,26 +176,29 @@ private async Task DownloadToOfflineCacheAsync(DirectoryPath offlineCache, bool
await GetDownloads(GetUpdatableWorkloads(), skipManifestUpdate: false, includePreviews, offlineCache.Value);
}
- private async Task> GetUpdatablePackageUrlsAsync(bool includePreview)
+ private async Task> GetUpdatablePackageUrlsAsync(bool includePreview, IReporter reporter = null, INuGetPackageDownloader packageDownloader = null)
{
- var downloads = await GetDownloads(GetUpdatableWorkloads(), skipManifestUpdate: false, includePreview);
+ reporter ??= Reporter;
+ packageDownloader ??= PackageDownloader;
+ var downloads = await GetDownloads(GetUpdatableWorkloads(reporter), skipManifestUpdate: false, includePreview, reporter: reporter, packageDownloader: packageDownloader);
var urls = new List();
foreach (var download in downloads)
{
- urls.Add(await PackageDownloader.GetPackageUrl(new PackageId(download.NuGetPackageId), new NuGetVersion(download.NuGetPackageVersion), _packageSourceLocation));
+ urls.Add(await packageDownloader.GetPackageUrl(new PackageId(download.NuGetPackageId), new NuGetVersion(download.NuGetPackageVersion), _packageSourceLocation));
}
return urls;
}
- private IEnumerable GetUpdatableWorkloads()
+ private IEnumerable GetUpdatableWorkloads(IReporter reporter = null)
{
+ reporter ??= Reporter;
var workloads = GetInstalledWorkloads(_fromPreviousSdk);
if (workloads == null || !workloads.Any())
{
- Reporter.WriteLine(LocalizableStrings.NoWorkloadsToUpdate);
+ reporter.WriteLine(LocalizableStrings.NoWorkloadsToUpdate);
}
return workloads;
diff --git a/src/Containers/Microsoft.NET.Build.Containers/BaseImageNotFoundException.cs b/src/Containers/Microsoft.NET.Build.Containers/BaseImageNotFoundException.cs
index 0b721ba060ac..c54083890163 100644
--- a/src/Containers/Microsoft.NET.Build.Containers/BaseImageNotFoundException.cs
+++ b/src/Containers/Microsoft.NET.Build.Containers/BaseImageNotFoundException.cs
@@ -6,5 +6,5 @@ namespace Microsoft.NET.Build.Containers;
public sealed class BaseImageNotFoundException : Exception
{
internal BaseImageNotFoundException(string specifiedRuntimeIdentifier, string repositoryName, string reference, IEnumerable supportedRuntimeIdentifiers)
- : base($"The RuntimeIdentifier '{specifiedRuntimeIdentifier}' is not supported by {repositoryName}:{reference}. The supported RuntimeIdentifiers are {String.Join(",", supportedRuntimeIdentifiers)}") { }
+ : base($"The RuntimeIdentifier '{specifiedRuntimeIdentifier}' is not supported by {repositoryName}:{reference}. The supported RuntimeIdentifiers are {string.Join(",", supportedRuntimeIdentifiers)}") { }
}
diff --git a/src/Containers/Microsoft.NET.Build.Containers/ContainerHelpers.cs b/src/Containers/Microsoft.NET.Build.Containers/ContainerHelpers.cs
index bac89da9cb7f..3aac2935fe27 100644
--- a/src/Containers/Microsoft.NET.Build.Containers/ContainerHelpers.cs
+++ b/src/Containers/Microsoft.NET.Build.Containers/ContainerHelpers.cs
@@ -50,7 +50,7 @@ public static bool TryParsePort(string? portNumber, string? portType, [NotNullWh
{
var portNo = 0;
error = null;
- if (String.IsNullOrEmpty(portNumber))
+ if (string.IsNullOrEmpty(portNumber))
{
error = ParsePortError.MissingPortNumber;
}
diff --git a/src/Containers/Microsoft.NET.Build.Containers/LocalDaemons/DockerCli.cs b/src/Containers/Microsoft.NET.Build.Containers/LocalDaemons/DockerCli.cs
index 0573d30ce85b..b7b0733ad52a 100644
--- a/src/Containers/Microsoft.NET.Build.Containers/LocalDaemons/DockerCli.cs
+++ b/src/Containers/Microsoft.NET.Build.Containers/LocalDaemons/DockerCli.cs
@@ -78,10 +78,12 @@ public async Task LoadAsync(BuiltImage image, SourceImageReference sourceReferen
string commandPath = await FindFullCommandPath(cancellationToken);
// call `docker load` and get it ready to receive input
- ProcessStartInfo loadInfo = new(commandPath, $"load");
- loadInfo.RedirectStandardInput = true;
- loadInfo.RedirectStandardOutput = true;
- loadInfo.RedirectStandardError = true;
+ ProcessStartInfo loadInfo = new(commandPath, $"load")
+ {
+ RedirectStandardInput = true,
+ RedirectStandardOutput = true,
+ RedirectStandardError = true
+ };
using Process? loadProcess = Process.Start(loadInfo);
diff --git a/src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs b/src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs
index 669edba9590e..ffe30386de2e 100644
--- a/src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs
+++ b/src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs
@@ -98,7 +98,7 @@ internal async Task ExecuteAsync(CancellationToken cancellationToken)
return !Log.HasLoggedErrors;
}
- SafeLog(Strings.ContainerBuilder_StartBuildingImage, Repository, String.Join(",", ImageTags), sourceImageReference);
+ SafeLog(Strings.ContainerBuilder_StartBuildingImage, Repository, string.Join(",", ImageTags), sourceImageReference);
Layer newLayer = Layer.FromDirectory(PublishDirectory, WorkingDirectory, imageBuilder.IsWindows);
imageBuilder.AddLayer(newLayer);
diff --git a/src/Containers/Microsoft.NET.Build.Containers/Tasks/ParseContainerProperties.cs b/src/Containers/Microsoft.NET.Build.Containers/Tasks/ParseContainerProperties.cs
index f7bc4c755ceb..926f63508865 100644
--- a/src/Containers/Microsoft.NET.Build.Containers/Tasks/ParseContainerProperties.cs
+++ b/src/Containers/Microsoft.NET.Build.Containers/Tasks/ParseContainerProperties.cs
@@ -82,13 +82,13 @@ public ParseContainerProperties()
public override bool Execute()
{
string[] validTags;
- if (!String.IsNullOrEmpty(ContainerImageTag) && ContainerImageTags.Length >= 1)
+ if (!string.IsNullOrEmpty(ContainerImageTag) && ContainerImageTags.Length >= 1)
{
Log.LogErrorWithCodeFromResources(nameof(Strings.AmbiguousTags), nameof(ContainerImageTag), nameof(ContainerImageTags));
return !Log.HasLoggedErrors;
}
- if (!String.IsNullOrEmpty(ContainerImageTag))
+ if (!string.IsNullOrEmpty(ContainerImageTag))
{
if (ContainerHelpers.IsValidImageTag(ContainerImageTag))
{
@@ -105,7 +105,7 @@ public override bool Execute()
validTags = valids;
if (invalids.Any())
{
- Log.LogErrorWithCodeFromResources(nameof(Strings.InvalidTags), nameof(ContainerImageTags), String.Join(",", invalids));
+ Log.LogErrorWithCodeFromResources(nameof(Strings.InvalidTags), nameof(ContainerImageTags), string.Join(",", invalids));
return !Log.HasLoggedErrors;
}
}
@@ -114,7 +114,7 @@ public override bool Execute()
validTags = Array.Empty();
}
- if (!String.IsNullOrEmpty(ContainerRegistry) && !ContainerHelpers.IsValidRegistry(ContainerRegistry))
+ if (!string.IsNullOrEmpty(ContainerRegistry) && !ContainerHelpers.IsValidRegistry(ContainerRegistry))
{
Log.LogErrorWithCodeFromResources(nameof(Strings.CouldntRecognizeRegistry), ContainerRegistry);
return !Log.HasLoggedErrors;
@@ -173,7 +173,7 @@ public override bool Execute()
Log.LogMessage(MessageImportance.Low, "Image: {0}", ParsedContainerImage);
Log.LogMessage(MessageImportance.Low, "Tag: {0}", ParsedContainerTag);
Log.LogMessage(MessageImportance.Low, "Image Name: {0}", NewContainerRepository);
- Log.LogMessage(MessageImportance.Low, "Image Tags: {0}", String.Join(", ", NewContainerTags));
+ Log.LogMessage(MessageImportance.Low, "Image Tags: {0}", string.Join(", ", NewContainerTags));
}
return !Log.HasLoggedErrors;
diff --git a/src/RazorSdk/Tool/ServerProtocol/NativeMethods.cs b/src/RazorSdk/Tool/ServerProtocol/NativeMethods.cs
index fd7a330485fd..57248b141e90 100644
--- a/src/RazorSdk/Tool/ServerProtocol/NativeMethods.cs
+++ b/src/RazorSdk/Tool/ServerProtocol/NativeMethods.cs
@@ -6,20 +6,20 @@ namespace Microsoft.NET.Sdk.Razor.Tool
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal struct STARTUPINFO
{
- internal Int32 cb;
+ internal int cb;
internal string lpReserved;
internal string lpDesktop;
internal string lpTitle;
- internal Int32 dwX;
- internal Int32 dwY;
- internal Int32 dwXSize;
- internal Int32 dwYSize;
- internal Int32 dwXCountChars;
- internal Int32 dwYCountChars;
- internal Int32 dwFillAttribute;
- internal Int32 dwFlags;
- internal Int16 wShowWindow;
- internal Int16 cbReserved2;
+ internal int dwX;
+ internal int dwY;
+ internal int dwXSize;
+ internal int dwYSize;
+ internal int dwXCountChars;
+ internal int dwYCountChars;
+ internal int dwFillAttribute;
+ internal int dwFlags;
+ internal short wShowWindow;
+ internal short cbReserved2;
internal IntPtr lpReserved2;
internal IntPtr hStdInput;
internal IntPtr hStdOutput;
@@ -47,7 +47,7 @@ internal static class NativeMethods
internal const uint NORMAL_PRIORITY_CLASS = 0x0020;
internal const uint CREATE_NO_WINDOW = 0x08000000;
- internal const Int32 STARTF_USESTDHANDLES = 0x00000100;
+ internal const int STARTF_USESTDHANDLES = 0x00000100;
internal const int ERROR_SUCCESS = 0;
#endregion
diff --git a/src/Resolvers/Microsoft.DotNet.SdkResolver/NETCoreSdkResolver.cs b/src/Resolvers/Microsoft.DotNet.SdkResolver/NETCoreSdkResolver.cs
index 79fdeec47e67..78689802c0ca 100644
--- a/src/Resolvers/Microsoft.DotNet.SdkResolver/NETCoreSdkResolver.cs
+++ b/src/Resolvers/Microsoft.DotNet.SdkResolver/NETCoreSdkResolver.cs
@@ -112,7 +112,7 @@ private CompatibleSdkValue GetMostCompatibleSdks(string dotnetExeDirectory, Vers
continue;
}
- if (minimumSdkMajorVersion != 0 && Int32.TryParse(netcoreSdkVersion.Split('.')[0], out int sdkMajorVersion) && sdkMajorVersion < minimumSdkMajorVersion)
+ if (minimumSdkMajorVersion != 0 && int.TryParse(netcoreSdkVersion.Split('.')[0], out int sdkMajorVersion) && sdkMajorVersion < minimumSdkMajorVersion)
{
continue;
}
diff --git a/src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/WorkloadSet.cs b/src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/WorkloadSet.cs
index 84326f533487..c7ab03ddcbbd 100644
--- a/src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/WorkloadSet.cs
+++ b/src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/WorkloadSet.cs
@@ -42,7 +42,7 @@ public static WorkloadSet FromDictionaryForJson(IDictionary dict
string manifestVersionString = parts[0];
if (!FXVersion.TryParse(manifestVersionString, out FXVersion version))
{
- throw new FormatException(String.Format(Strings.InvalidVersionForWorkload, manifest.Key, manifestVersionString));
+ throw new FormatException(string.Format(Strings.InvalidVersionForWorkload, manifest.Key, manifestVersionString));
}
manifestVersion = new ManifestVersion(parts[0]);
diff --git a/src/StaticWebAssetsSdk/Tasks/ReferencedProjectConfiguration.cs b/src/StaticWebAssetsSdk/Tasks/ReferencedProjectConfiguration.cs
index d7119eff24ca..93093fbdd926 100644
--- a/src/StaticWebAssetsSdk/Tasks/ReferencedProjectConfiguration.cs
+++ b/src/StaticWebAssetsSdk/Tasks/ReferencedProjectConfiguration.cs
@@ -97,17 +97,18 @@ public ITaskItem ToTaskItem()
internal static ReferencedProjectConfiguration FromTaskItem(ITaskItem arg)
{
- var result = new ReferencedProjectConfiguration();
-
- result.Identity = arg.GetMetadata("FullPath");
- result.Version = int.Parse(arg.GetMetadata(nameof(Version)), CultureInfo.InvariantCulture);
- result.Source = arg.GetMetadata(nameof(Source));
- result.GetBuildAssetsTargets = arg.GetMetadata(nameof(GetBuildAssetsTargets));
- result.AdditionalBuildProperties = arg.GetMetadata(nameof(AdditionalBuildProperties));
- result.AdditionalBuildPropertiesToRemove = arg.GetMetadata(nameof(AdditionalBuildPropertiesToRemove));
- result.GetPublishAssetsTargets = arg.GetMetadata(nameof(GetPublishAssetsTargets));
- result.AdditionalPublishProperties = arg.GetMetadata(nameof(AdditionalPublishProperties));
- result.AdditionalPublishPropertiesToRemove = arg.GetMetadata(nameof(AdditionalPublishPropertiesToRemove));
+ var result = new ReferencedProjectConfiguration
+ {
+ Identity = arg.GetMetadata("FullPath"),
+ Version = int.Parse(arg.GetMetadata(nameof(Version)), CultureInfo.InvariantCulture),
+ Source = arg.GetMetadata(nameof(Source)),
+ GetBuildAssetsTargets = arg.GetMetadata(nameof(GetBuildAssetsTargets)),
+ AdditionalBuildProperties = arg.GetMetadata(nameof(AdditionalBuildProperties)),
+ AdditionalBuildPropertiesToRemove = arg.GetMetadata(nameof(AdditionalBuildPropertiesToRemove)),
+ GetPublishAssetsTargets = arg.GetMetadata(nameof(GetPublishAssetsTargets)),
+ AdditionalPublishProperties = arg.GetMetadata(nameof(AdditionalPublishProperties)),
+ AdditionalPublishPropertiesToRemove = arg.GetMetadata(nameof(AdditionalPublishPropertiesToRemove))
+ };
return result;
}
diff --git a/src/StaticWebAssetsSdk/Tasks/StaticWebAssetsDiscoveryPattern.cs b/src/StaticWebAssetsSdk/Tasks/StaticWebAssetsDiscoveryPattern.cs
index e0c85a6943d0..900af7b0d65c 100644
--- a/src/StaticWebAssetsSdk/Tasks/StaticWebAssetsDiscoveryPattern.cs
+++ b/src/StaticWebAssetsSdk/Tasks/StaticWebAssetsDiscoveryPattern.cs
@@ -65,13 +65,14 @@ internal static bool HasSourceId(string candidate, string source) =>
internal static StaticWebAssetsDiscoveryPattern FromTaskItem(ITaskItem pattern)
{
- var result = new StaticWebAssetsDiscoveryPattern();
-
- result.Name = pattern.ItemSpec;
- result.Source = pattern.GetMetadata(nameof(Source));
- result.BasePath = pattern.GetMetadata(nameof(BasePath));
- result.ContentRoot = pattern.GetMetadata(nameof(ContentRoot));
- result.Pattern = pattern.GetMetadata(nameof(Pattern));
+ var result = new StaticWebAssetsDiscoveryPattern
+ {
+ Name = pattern.ItemSpec,
+ Source = pattern.GetMetadata(nameof(Source)),
+ BasePath = pattern.GetMetadata(nameof(BasePath)),
+ ContentRoot = pattern.GetMetadata(nameof(ContentRoot)),
+ Pattern = pattern.GetMetadata(nameof(Pattern))
+ };
return result;
}
diff --git a/src/Tasks/Common/ConflictResolution/ConflictItem.cs b/src/Tasks/Common/ConflictResolution/ConflictItem.cs
index 0c909a45adf5..9c99187a85af 100644
--- a/src/Tasks/Common/ConflictResolution/ConflictItem.cs
+++ b/src/Tasks/Common/ConflictResolution/ConflictItem.cs
@@ -69,7 +69,7 @@ public Version AssemblyVersion
{
_assemblyVersion = null;
- var assemblyVersionString = OriginalItem?.GetMetadata(nameof(AssemblyVersion)) ?? String.Empty;
+ var assemblyVersionString = OriginalItem?.GetMetadata(nameof(AssemblyVersion)) ?? string.Empty;
if (assemblyVersionString.Length != 0)
{
@@ -116,7 +116,7 @@ public string FileName
{
if (_fileName == null)
{
- _fileName = OriginalItem == null ? String.Empty : Path.GetFileName(OriginalItem.ItemSpec);
+ _fileName = OriginalItem == null ? string.Empty : Path.GetFileName(OriginalItem.ItemSpec);
}
return _fileName;
}
@@ -133,7 +133,7 @@ public Version FileVersion
{
_fileVersion = null;
- var fileVersionString = OriginalItem?.GetMetadata(nameof(FileVersion)) ?? String.Empty;
+ var fileVersionString = OriginalItem?.GetMetadata(nameof(FileVersion)) ?? string.Empty;
if (fileVersionString.Length != 0)
{
@@ -190,7 +190,7 @@ public ConflictVersion PackageVersion
{
_packageVersion = null;
- var packageVersionString = OriginalItem?.GetMetadata(nameof(MetadataNames.NuGetPackageVersion)) ?? String.Empty;
+ var packageVersionString = OriginalItem?.GetMetadata(nameof(MetadataNames.NuGetPackageVersion)) ?? string.Empty;
if (packageVersionString.Length != 0)
{
@@ -212,7 +212,7 @@ public string SourcePath
{
if (_sourcePath == null)
{
- _sourcePath = ItemUtilities.GetSourcePath(OriginalItem) ?? String.Empty;
+ _sourcePath = ItemUtilities.GetSourcePath(OriginalItem) ?? string.Empty;
}
return _sourcePath.Length == 0 ? null : _sourcePath;
diff --git a/src/Tasks/Common/ConflictResolution/ConflictResolver.cs b/src/Tasks/Common/ConflictResolution/ConflictResolver.cs
index 96c6356c5d34..ba4939cf7839 100644
--- a/src/Tasks/Common/ConflictResolution/ConflictResolver.cs
+++ b/src/Tasks/Common/ConflictResolution/ConflictResolver.cs
@@ -44,7 +44,7 @@ public void ResolveConflicts(IEnumerable conflictItems, FuncBoolean true or false, corresponding to the string.
internal static bool ConvertStringToBool(string parameterValue, bool defaultValue = false)
{
- if (String.IsNullOrEmpty(parameterValue))
+ if (string.IsNullOrEmpty(parameterValue))
{
return defaultValue;
}
@@ -48,12 +48,12 @@ internal static bool ConvertStringToBool(string parameterValue, bool defaultValu
///
private static bool ValidBooleanTrue(string parameterValue)
{
- return ((String.Compare(parameterValue, "true", StringComparison.OrdinalIgnoreCase) == 0) ||
- (String.Compare(parameterValue, "on", StringComparison.OrdinalIgnoreCase) == 0) ||
- (String.Compare(parameterValue, "yes", StringComparison.OrdinalIgnoreCase) == 0) ||
- (String.Compare(parameterValue, "!false", StringComparison.OrdinalIgnoreCase) == 0) ||
- (String.Compare(parameterValue, "!off", StringComparison.OrdinalIgnoreCase) == 0) ||
- (String.Compare(parameterValue, "!no", StringComparison.OrdinalIgnoreCase) == 0));
+ return ((string.Compare(parameterValue, "true", StringComparison.OrdinalIgnoreCase) == 0) ||
+ (string.Compare(parameterValue, "on", StringComparison.OrdinalIgnoreCase) == 0) ||
+ (string.Compare(parameterValue, "yes", StringComparison.OrdinalIgnoreCase) == 0) ||
+ (string.Compare(parameterValue, "!false", StringComparison.OrdinalIgnoreCase) == 0) ||
+ (string.Compare(parameterValue, "!off", StringComparison.OrdinalIgnoreCase) == 0) ||
+ (string.Compare(parameterValue, "!no", StringComparison.OrdinalIgnoreCase) == 0));
}
///
@@ -62,12 +62,12 @@ private static bool ValidBooleanTrue(string parameterValue)
///
private static bool ValidBooleanFalse(string parameterValue)
{
- return ((String.Compare(parameterValue, "false", StringComparison.OrdinalIgnoreCase) == 0) ||
- (String.Compare(parameterValue, "off", StringComparison.OrdinalIgnoreCase) == 0) ||
- (String.Compare(parameterValue, "no", StringComparison.OrdinalIgnoreCase) == 0) ||
- (String.Compare(parameterValue, "!true", StringComparison.OrdinalIgnoreCase) == 0) ||
- (String.Compare(parameterValue, "!on", StringComparison.OrdinalIgnoreCase) == 0) ||
- (String.Compare(parameterValue, "!yes", StringComparison.OrdinalIgnoreCase) == 0));
+ return ((string.Compare(parameterValue, "false", StringComparison.OrdinalIgnoreCase) == 0) ||
+ (string.Compare(parameterValue, "off", StringComparison.OrdinalIgnoreCase) == 0) ||
+ (string.Compare(parameterValue, "no", StringComparison.OrdinalIgnoreCase) == 0) ||
+ (string.Compare(parameterValue, "!true", StringComparison.OrdinalIgnoreCase) == 0) ||
+ (string.Compare(parameterValue, "!on", StringComparison.OrdinalIgnoreCase) == 0) ||
+ (string.Compare(parameterValue, "!yes", StringComparison.OrdinalIgnoreCase) == 0));
}
}
}
diff --git a/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/GetDependsOnNETStandard.net46.cs b/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/GetDependsOnNETStandard.net46.cs
index 18ef1174ee9f..d030ddf4be2c 100644
--- a/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/GetDependsOnNETStandard.net46.cs
+++ b/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/GetDependsOnNETStandard.net46.cs
@@ -48,8 +48,8 @@ internal static bool GetFileDependsOnNETStandard(string filePath)
var assemblyImport = (IMetaDataAssemblyImport)metadataDispenser.OpenScope(filePathAbsolute, 0, s_importerGuid);
var asmRefEnum = IntPtr.Zero;
- var asmRefTokens = new UInt32[16];
- UInt32 fetched;
+ var asmRefTokens = new uint[16];
+ uint fetched;
var assemblyMD = new ASSEMBLYMETADATA()
{
@@ -77,7 +77,7 @@ internal static bool GetFileDependsOnNETStandard(string filePath)
{
// Determine the length of the string to contain the name first.
IntPtr hashDataPtr, pubKeyPtr;
- UInt32 hashDataLength, pubKeyBytes, asmNameLength, flags;
+ uint hashDataLength, pubKeyBytes, asmNameLength, flags;
assemblyImport.GetAssemblyRefProps(
asmRefTokens[i],
out pubKeyPtr,
@@ -163,13 +163,13 @@ internal class CorMetaDataDispenser
internal interface IMetaDataDispenser
{
[return: MarshalAs(UnmanagedType.Interface)]
- object DefineScope([In] ref Guid rclsid, [In] UInt32 dwCreateFlags, [In] ref Guid riid);
+ object DefineScope([In] ref Guid rclsid, [In] uint dwCreateFlags, [In] ref Guid riid);
[return: MarshalAs(UnmanagedType.Interface)]
- object OpenScope([In][MarshalAs(UnmanagedType.LPWStr)] string szScope, [In] UInt32 dwOpenFlags, [In] ref Guid riid);
+ object OpenScope([In][MarshalAs(UnmanagedType.LPWStr)] string szScope, [In] uint dwOpenFlags, [In] ref Guid riid);
[return: MarshalAs(UnmanagedType.Interface)]
- object OpenScopeOnMemory([In] IntPtr pData, [In] UInt32 cbData, [In] UInt32 dwOpenFlags, [In] ref Guid riid);
+ object OpenScopeOnMemory([In] IntPtr pData, [In] uint cbData, [In] uint dwOpenFlags, [In] ref Guid riid);
}
[ComImport]
@@ -177,16 +177,16 @@ internal interface IMetaDataDispenser
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
internal interface IMetaDataAssemblyImport
{
- void GetAssemblyProps(UInt32 mdAsm, out IntPtr pPublicKeyPtr, out UInt32 ucbPublicKeyPtr, out UInt32 uHashAlg, StringBuilder strName, UInt32 cchNameIn, out UInt32 cchNameRequired, IntPtr amdInfo, out UInt32 dwFlags);
- void GetAssemblyRefProps(UInt32 mdAsmRef, out IntPtr ppbPublicKeyOrToken, out UInt32 pcbPublicKeyOrToken, StringBuilder strName, UInt32 cchNameIn, out UInt32 pchNameOut, ref ASSEMBLYMETADATA amdInfo, out IntPtr ppbHashValue, out UInt32 pcbHashValue, out UInt32 pdwAssemblyRefFlags);
- void GetFileProps([In] UInt32 mdFile, StringBuilder strName, UInt32 cchName, out UInt32 cchNameRequired, out IntPtr bHashData, out UInt32 cchHashBytes, out UInt32 dwFileFlags);
+ void GetAssemblyProps(uint mdAsm, out IntPtr pPublicKeyPtr, out uint ucbPublicKeyPtr, out uint uHashAlg, StringBuilder strName, uint cchNameIn, out uint cchNameRequired, IntPtr amdInfo, out uint dwFlags);
+ void GetAssemblyRefProps(uint mdAsmRef, out IntPtr ppbPublicKeyOrToken, out uint pcbPublicKeyOrToken, StringBuilder strName, uint cchNameIn, out uint pchNameOut, ref ASSEMBLYMETADATA amdInfo, out IntPtr ppbHashValue, out uint pcbHashValue, out uint pdwAssemblyRefFlags);
+ void GetFileProps([In] uint mdFile, StringBuilder strName, uint cchName, out uint cchNameRequired, out IntPtr bHashData, out uint cchHashBytes, out uint dwFileFlags);
void GetExportedTypeProps();
void GetManifestResourceProps();
- void EnumAssemblyRefs([In, Out] ref IntPtr phEnum, [MarshalAs(UnmanagedType.LPArray), Out] UInt32[] asmRefs, System.UInt32 asmRefCount, out System.UInt32 iFetched);
- void EnumFiles([In, Out] ref IntPtr phEnum, [MarshalAs(UnmanagedType.LPArray), Out] UInt32[] fileRefs, System.UInt32 fileRefCount, out System.UInt32 iFetched);
+ void EnumAssemblyRefs([In, Out] ref IntPtr phEnum, [MarshalAs(UnmanagedType.LPArray), Out] uint[] asmRefs, uint asmRefCount, out uint iFetched);
+ void EnumFiles([In, Out] ref IntPtr phEnum, [MarshalAs(UnmanagedType.LPArray), Out] uint[] fileRefs, uint fileRefCount, out uint iFetched);
void EnumExportedTypes();
void EnumManifestResources();
- void GetAssemblyFromScope(out UInt32 mdAsm);
+ void GetAssemblyFromScope(out uint mdAsm);
void FindExportedTypeByName();
void FindManifestResourceByName();
// PreserveSig because this method is an exception that
@@ -216,16 +216,16 @@ typedef struct
[StructLayout(LayoutKind.Sequential)]
internal struct ASSEMBLYMETADATA
{
- public UInt16 usMajorVersion;
- public UInt16 usMinorVersion;
- public UInt16 usBuildNumber;
- public UInt16 usRevisionNumber;
+ public ushort usMajorVersion;
+ public ushort usMinorVersion;
+ public ushort usBuildNumber;
+ public ushort usRevisionNumber;
public IntPtr rpLocale;
- public UInt32 cchLocale;
+ public uint cchLocale;
public IntPtr rpProcessors;
- public UInt32 cProcessors;
+ public uint cProcessors;
public IntPtr rOses;
- public UInt32 cOses;
+ public uint cOses;
}
#endregion
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GetPublishItemsOutputGroupOutputsTests.cs b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GetPublishItemsOutputGroupOutputsTests.cs
index 25f67b68d1aa..47bbd7319afe 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GetPublishItemsOutputGroupOutputsTests.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GetPublishItemsOutputGroupOutputsTests.cs
@@ -31,12 +31,13 @@ private readonly MockTaskItem _apphost
[WindowsOnlyFact]
public void It_can_expand_OutputPath()
{
- var task = new GetPublishItemsOutputGroupOutputs();
-
- task.PublishDir = @"bin\Debug\net5.0\publish\";
- task.ResolvedFileToPublish = new[]
+ var task = new GetPublishItemsOutputGroupOutputs
{
- _apphost, _dll, _dll
+ PublishDir = @"bin\Debug\net5.0\publish\",
+ ResolvedFileToPublish = new[]
+ {
+ _apphost, _dll, _dll
+ }
};
task.Execute().Should().BeTrue();
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenADependencyContextBuilder.cs b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenADependencyContextBuilder.cs
index 38edeb944fad..dd1318c0d1b2 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenADependencyContextBuilder.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenADependencyContextBuilder.cs
@@ -85,8 +85,10 @@ public void ItBuildsDependencyContextsFromProjectLockFiles(
using (JsonTextWriter writer = new(File.CreateText($"result-{baselineFileName}.deps.json")))
{
- JsonSerializer serializer = new();
- serializer.Formatting = Formatting.Indented;
+ JsonSerializer serializer = new()
+ {
+ Formatting = Formatting.Indented
+ };
serializer.Serialize(writer, result);
}
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAProduceContentsAssetsTask.cs b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAProduceContentsAssetsTask.cs
index ce099c87bd87..a2278e226565 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAProduceContentsAssetsTask.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAProduceContentsAssetsTask.cs
@@ -24,8 +24,10 @@ public void ItProcessesContentFiles()
};
// mock preprocessor
- var assetPreprocessor = new MockContentAssetPreprocessor((s) => false);
- assetPreprocessor.MockReadContent = inputText;
+ var assetPreprocessor = new MockContentAssetPreprocessor((s) => false)
+ {
+ MockReadContent = inputText
+ };
// input items
var contentPreprocessorValues = GetPreprocessorValueItems(preprocessorValues);
@@ -73,8 +75,10 @@ public void ItOutputsFileWritesForProcessedContent()
};
// mock preprocessor
- var assetPreprocessor = new MockContentAssetPreprocessor((s) => false);
- assetPreprocessor.MockReadContent = inputText;
+ var assetPreprocessor = new MockContentAssetPreprocessor((s) => false)
+ {
+ MockReadContent = inputText
+ };
// input items
var contentPreprocessorValues = GetPreprocessorValueItems(preprocessorValues);
@@ -127,8 +131,10 @@ public void ItOutputsCopyLocalItems()
};
// mock preprocessor
- var assetPreprocessor = new MockContentAssetPreprocessor((s) => false);
- assetPreprocessor.MockReadContent = inputText;
+ var assetPreprocessor = new MockContentAssetPreprocessor((s) => false)
+ {
+ MockReadContent = inputText
+ };
// input items
var contentPreprocessorValues = GetPreprocessorValueItems(preprocessorValues);
@@ -204,8 +210,10 @@ public void ItOutputsContentItemsWithActiveBuildAction()
};
// mock preprocessor
- var assetPreprocessor = new MockContentAssetPreprocessor((s) => false);
- assetPreprocessor.MockReadContent = inputText;
+ var assetPreprocessor = new MockContentAssetPreprocessor((s) => false)
+ {
+ MockReadContent = inputText
+ };
// input items
var contentPreprocessorValues = GetPreprocessorValueItems(preprocessorValues);
@@ -280,8 +288,10 @@ public void ItCanOutputOnlyPreprocessedItems()
};
// mock preprocessor
- var assetPreprocessor = new MockContentAssetPreprocessor((s) => false);
- assetPreprocessor.MockReadContent = inputText;
+ var assetPreprocessor = new MockContentAssetPreprocessor((s) => false)
+ {
+ MockReadContent = inputText
+ };
// input items
var contentPreprocessorValues = GetPreprocessorValueItems(preprocessorValues);
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAResolveTargetingPackAssetsTask.cs b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAResolveTargetingPackAssetsTask.cs
index 5b73dbf3c537..b185a441f76f 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAResolveTargetingPackAssetsTask.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAResolveTargetingPackAssetsTask.cs
@@ -140,17 +140,14 @@ private ResolveTargetingPackAssets InitializeMockTargetingPackAssetsDirectory(ou
private ResolveTargetingPackAssets InitializeTask(string mockPackageDirectory, IBuildEngine buildEngine)
{
- var task = new ResolveTargetingPackAssets()
+ var task = new ResolveTargetingPackAssets
{
BuildEngine = buildEngine,
+ FrameworkReferences = DefaultFrameworkReferences(),
+ ResolvedTargetingPacks = DefaultTargetingPacks(mockPackageDirectory),
+ ProjectLanguage = "C#"
};
- task.FrameworkReferences = DefaultFrameworkReferences();
-
- task.ResolvedTargetingPacks = DefaultTargetingPacks(mockPackageDirectory);
-
- task.ProjectLanguage = "C#";
-
return task;
}
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAnAssetsFileResolver.cs b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAnAssetsFileResolver.cs
index 5bc7c64a1aa8..4e85850ee060 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAnAssetsFileResolver.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAnAssetsFileResolver.cs
@@ -189,7 +189,7 @@ private static ResolvedFile CreateResolvedFile(
string sourcedir = Path.GetDirectoryName(sourcepath);
string destinationSubDirPath = preserveStoreLayout ? sourcedir.Substring(packageRoot.Length) : destinationSubDirectory;
- if (!String.IsNullOrEmpty(destinationSubDirPath) && !destinationSubDirPath.EndsWith(Path.DirectorySeparatorChar))
+ if (!string.IsNullOrEmpty(destinationSubDirPath) && !destinationSubDirPath.EndsWith(Path.DirectorySeparatorChar))
{
destinationSubDirPath += Path.DirectorySeparatorChar;
}
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenUnresolvedSDKProjectItemsAndImplicitPackages.cs b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenUnresolvedSDKProjectItemsAndImplicitPackages.cs
index 805d9dc69dfb..fa54dd0fc1d2 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenUnresolvedSDKProjectItemsAndImplicitPackages.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenUnresolvedSDKProjectItemsAndImplicitPackages.cs
@@ -60,18 +60,22 @@ public void ItShouldCombineSdkReferencesWithImplicitPackageReferences()
{ MetadataKeys.Version, "1.2.3" }
});
- var task = new CollectSDKReferencesDesignTime();
- task.SdkReferences = new[] {
- sdkReference1,
- sdkReference2
- };
- task.PackageReferences = new ITaskItem[] {
- packageReference1,
- packageReference2,
- packageReference3,
- defaultImplicitPackage1
+ var task = new CollectSDKReferencesDesignTime
+ {
+ SdkReferences = new[]
+ {
+ sdkReference1,
+ sdkReference2
+ },
+ PackageReferences = new ITaskItem[]
+ {
+ packageReference1,
+ packageReference2,
+ packageReference3,
+ defaultImplicitPackage1
+ },
+ DefaultImplicitPackages = "DefaultImplicitPackage1;SomeOtherImplicitPackage"
};
- task.DefaultImplicitPackages = "DefaultImplicitPackage1;SomeOtherImplicitPackage";
// Act
var result = task.Execute();
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/ProcessFrameworkReferencesTests.cs b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/ProcessFrameworkReferencesTests.cs
index 75ccc34cbd06..ffba06ea5894 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/ProcessFrameworkReferencesTests.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/ProcessFrameworkReferencesTests.cs
@@ -43,28 +43,28 @@ private MockTaskItem _validWindowsSDKKnownFrameworkReference
[Fact]
public void It_resolves_FrameworkReferences()
{
- var task = new ProcessFrameworkReferences();
-
- task.EnableTargetingPackDownload = true;
- task.TargetFrameworkIdentifier = ".NETCoreApp";
- task.TargetFrameworkVersion = ToolsetInfo.CurrentTargetFrameworkVersion;
- task.FrameworkReferences = new[]
- {
- new MockTaskItem("Microsoft.AspNetCore.App", new Dictionary())
- };
-
- task.KnownFrameworkReferences = new[]
+ var task = new ProcessFrameworkReferences
{
- new MockTaskItem("Microsoft.AspNetCore.App",
- new Dictionary()
- {
- {"TargetFramework", ToolsetInfo.CurrentTargetFramework},
- {"RuntimeFrameworkName", "Microsoft.AspNetCore.App"},
- {"DefaultRuntimeFrameworkVersion", "1.9.5"},
- {"LatestRuntimeFrameworkVersion", "1.9.6"},
- {"TargetingPackName", "Microsoft.AspNetCore.App"},
- {"TargetingPackVersion", "1.9.0"}
- })
+ EnableTargetingPackDownload = true,
+ TargetFrameworkIdentifier = ".NETCoreApp",
+ TargetFrameworkVersion = ToolsetInfo.CurrentTargetFrameworkVersion,
+ FrameworkReferences = new[]
+ {
+ new MockTaskItem("Microsoft.AspNetCore.App", new Dictionary())
+ },
+ KnownFrameworkReferences = new[]
+ {
+ new MockTaskItem("Microsoft.AspNetCore.App",
+ new Dictionary()
+ {
+ {"TargetFramework", ToolsetInfo.CurrentTargetFramework},
+ {"RuntimeFrameworkName", "Microsoft.AspNetCore.App"},
+ {"DefaultRuntimeFrameworkVersion", "1.9.5"},
+ {"LatestRuntimeFrameworkVersion", "1.9.6"},
+ {"TargetingPackName", "Microsoft.AspNetCore.App"},
+ {"TargetingPackVersion", "1.9.0"}
+ })
+ }
};
task.Execute().Should().BeTrue();
@@ -79,30 +79,30 @@ public void It_resolves_FrameworkReferences()
[Fact]
public void Given_targetPlatform_and_targetPlatform_version_It_resolves_FrameworkReferences_()
{
- var task = new ProcessFrameworkReferences();
-
- task.EnableTargetingPackDownload = true;
- task.TargetFrameworkIdentifier = ".NETCoreApp";
- task.TargetFrameworkVersion = ToolsetInfo.CurrentTargetFrameworkVersion;
- task.TargetPlatformIdentifier = "Windows";
- task.TargetPlatformVersion = "10.0.18362";
- task.FrameworkReferences = new[]
- {
- new MockTaskItem("Microsoft.AspNetCore.App", new Dictionary())
- };
-
- task.KnownFrameworkReferences = new[]
+ var task = new ProcessFrameworkReferences
{
- new MockTaskItem("Microsoft.AspNetCore.App",
- new Dictionary()
- {
- {"TargetFramework", ToolsetInfo.CurrentTargetFramework},
- {"RuntimeFrameworkName", "Microsoft.AspNetCore.App"},
- {"DefaultRuntimeFrameworkVersion", "1.9.5"},
- {"LatestRuntimeFrameworkVersion", "1.9.6"},
- {"TargetingPackName", "Microsoft.AspNetCore.App"},
- {"TargetingPackVersion", "1.9.0"}
- })
+ EnableTargetingPackDownload = true,
+ TargetFrameworkIdentifier = ".NETCoreApp",
+ TargetFrameworkVersion = ToolsetInfo.CurrentTargetFrameworkVersion,
+ TargetPlatformIdentifier = "Windows",
+ TargetPlatformVersion = "10.0.18362",
+ FrameworkReferences = new[]
+ {
+ new MockTaskItem("Microsoft.AspNetCore.App", new Dictionary())
+ },
+ KnownFrameworkReferences = new[]
+ {
+ new MockTaskItem("Microsoft.AspNetCore.App",
+ new Dictionary()
+ {
+ {"TargetFramework", ToolsetInfo.CurrentTargetFramework},
+ {"RuntimeFrameworkName", "Microsoft.AspNetCore.App"},
+ {"DefaultRuntimeFrameworkVersion", "1.9.5"},
+ {"LatestRuntimeFrameworkVersion", "1.9.6"},
+ {"TargetingPackName", "Microsoft.AspNetCore.App"},
+ {"TargetingPackVersion", "1.9.0"}
+ })
+ }
};
task.Execute().Should().BeTrue();
@@ -117,27 +117,27 @@ public void Given_targetPlatform_and_targetPlatform_version_It_resolves_Framewor
[Fact]
public void It_does_not_resolve_FrameworkReferences_if_targetframework_doesnt_match()
{
- var task = new ProcessFrameworkReferences();
-
- task.TargetFrameworkIdentifier = ".NETCoreApp";
- task.TargetFrameworkVersion = "2.0";
- task.FrameworkReferences = new[]
- {
- new MockTaskItem("Microsoft.AspNetCore.App", new Dictionary())
- };
-
- task.KnownFrameworkReferences = new[]
+ var task = new ProcessFrameworkReferences
{
- new MockTaskItem("Microsoft.AspNetCore.App",
- new Dictionary()
- {
- {"TargetFramework", "netcoreapp3.0"},
- {"RuntimeFrameworkName", "Microsoft.AspNetCore.App"},
- {"DefaultRuntimeFrameworkVersion", "1.9.5"},
- {"LatestRuntimeFrameworkVersion", "1.9.6"},
- {"TargetingPackName", "Microsoft.AspNetCore.App"},
- {"TargetingPackVersion", "1.9.0"}
- })
+ TargetFrameworkIdentifier = ".NETCoreApp",
+ TargetFrameworkVersion = "2.0",
+ FrameworkReferences = new[]
+ {
+ new MockTaskItem("Microsoft.AspNetCore.App", new Dictionary())
+ },
+ KnownFrameworkReferences = new[]
+ {
+ new MockTaskItem("Microsoft.AspNetCore.App",
+ new Dictionary()
+ {
+ {"TargetFramework", "netcoreapp3.0"},
+ {"RuntimeFrameworkName", "Microsoft.AspNetCore.App"},
+ {"DefaultRuntimeFrameworkVersion", "1.9.5"},
+ {"LatestRuntimeFrameworkVersion", "1.9.6"},
+ {"TargetingPackName", "Microsoft.AspNetCore.App"},
+ {"TargetingPackVersion", "1.9.0"}
+ })
+ }
};
task.Execute().Should().BeTrue();
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/AllowEmptyTelemetry.cs b/src/Tasks/Microsoft.NET.Build.Tasks/AllowEmptyTelemetry.cs
index c282154bd8f5..cb4cc9b94f36 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/AllowEmptyTelemetry.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/AllowEmptyTelemetry.cs
@@ -14,7 +14,7 @@ public sealed class AllowEmptyTelemetry : TaskBase
public AllowEmptyTelemetry()
{
EventData = Array.Empty();
- EventName = String.Empty;
+ EventName = string.Empty;
}
///
@@ -46,7 +46,7 @@ protected override void ExecuteCore()
{
value = HashWithNormalizedCasing(value);
}
- if (String.IsNullOrEmpty(value))
+ if (string.IsNullOrEmpty(value))
{
properties[key] = "null";
}
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/CollectSDKReferencesDesignTime.cs b/src/Tasks/Microsoft.NET.Build.Tasks/CollectSDKReferencesDesignTime.cs
index dc23d3dbd6c4..ef7d9fb87b8d 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/CollectSDKReferencesDesignTime.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/CollectSDKReferencesDesignTime.cs
@@ -74,7 +74,7 @@ private IEnumerable GetImplicitPackageReferences()
}
else
{
- Boolean.TryParse(isImplicitlyDefinedString, out isImplicitlyDefined);
+ bool.TryParse(isImplicitlyDefinedString, out isImplicitlyDefined);
}
if (isImplicitlyDefined)
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/GenerateRuntimeConfigurationFiles.cs b/src/Tasks/Microsoft.NET.Build.Tasks/GenerateRuntimeConfigurationFiles.cs
index 751c9e771835..d1d83c5dc048 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/GenerateRuntimeConfigurationFiles.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/GenerateRuntimeConfigurationFiles.cs
@@ -152,8 +152,10 @@ private void WriteRuntimeConfig(
bool isFrameworkDependent,
IList packageFolders)
{
- RuntimeConfig config = new();
- config.RuntimeOptions = new RuntimeOptions();
+ RuntimeConfig config = new()
+ {
+ RuntimeOptions = new RuntimeOptions()
+ };
AddFrameworks(
config.RuntimeOptions,
@@ -192,9 +194,11 @@ private void AddFrameworks(RuntimeOptions runtimeOptions,
// If there are no RuntimeFrameworks (which would be set in the ProcessFrameworkReferences task based
// on FrameworkReference items), then use package resolved from MicrosoftNETPlatformLibrary for
// the runtimeconfig
- RuntimeConfigFramework framework = new();
- framework.Name = lockFilePlatformLibrary.Name;
- framework.Version = lockFilePlatformLibrary.Version.ToNormalizedString();
+ RuntimeConfigFramework framework = new()
+ {
+ Name = lockFilePlatformLibrary.Name,
+ Version = lockFilePlatformLibrary.Version.ToNormalizedString()
+ };
frameworks.Add(framework);
}
@@ -224,9 +228,11 @@ private void AddFrameworks(RuntimeOptions runtimeOptions,
continue;
}
- RuntimeConfigFramework framework = new();
- framework.Name = platformLibrary.Name;
- framework.Version = platformLibrary.Version;
+ RuntimeConfigFramework framework = new()
+ {
+ Name = platformLibrary.Name,
+ Version = platformLibrary.Version
+ };
frameworks.Add(framework);
}
@@ -325,8 +331,10 @@ private static JToken GetConfigPropertyValue(ITaskItem hostConfigurationOption)
private void WriteDevRuntimeConfig(IList packageFolders)
{
- RuntimeConfig devConfig = new();
- devConfig.RuntimeOptions = new RuntimeOptions();
+ RuntimeConfig devConfig = new()
+ {
+ RuntimeOptions = new RuntimeOptions()
+ };
AddAdditionalProbingPaths(devConfig.RuntimeOptions, packageFolders);
@@ -373,10 +381,12 @@ private static string EnsureNoTrailingDirectorySeparator(string path)
private static void WriteToJsonFile(string fileName, object value)
{
- JsonSerializer serializer = new();
- serializer.ContractResolver = new CamelCasePropertyNamesContractResolver();
- serializer.Formatting = Formatting.Indented;
- serializer.DefaultValueHandling = DefaultValueHandling.Ignore;
+ JsonSerializer serializer = new()
+ {
+ ContractResolver = new CamelCasePropertyNamesContractResolver(),
+ Formatting = Formatting.Indented,
+ DefaultValueHandling = DefaultValueHandling.Ignore
+ };
using (JsonTextWriter writer = new(new StreamWriter(File.Create(fileName))))
{
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/PrepareForReadyToRunCompilation.cs b/src/Tasks/Microsoft.NET.Build.Tasks/PrepareForReadyToRunCompilation.cs
index 068c742de3f5..3bfbad774ee2 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/PrepareForReadyToRunCompilation.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/PrepareForReadyToRunCompilation.cs
@@ -212,8 +212,10 @@ private void ProcessInputFileList(
// This TaskItem corresponds to the output R2R image. It is equivalent to the input TaskItem, only the ItemSpec for it points to the new path
// for the newly created R2R image
- TaskItem r2rFileToPublish = new(file);
- r2rFileToPublish.ItemSpec = outputR2RImage;
+ TaskItem r2rFileToPublish = new(file)
+ {
+ ItemSpec = outputR2RImage
+ };
r2rFileToPublish.RemoveMetadata(MetadataKeys.OriginalItemSpec);
r2rFilesPublishList.Add(r2rFileToPublish);
@@ -227,8 +229,10 @@ private void ProcessInputFileList(
{
// This TaskItem is the R2R->R2RPDB entry, for a R2R image that was just created, and for which we need to create native PDBs. This will be used as
// an input to the ReadyToRunCompiler task
- TaskItem pdbCompilationEntry = new(file);
- pdbCompilationEntry.ItemSpec = outputR2RImage;
+ TaskItem pdbCompilationEntry = new(file)
+ {
+ ItemSpec = outputR2RImage
+ };
pdbCompilationEntry.SetMetadata(MetadataKeys.OutputPDBImage, outputPDBImage);
pdbCompilationEntry.SetMetadata(MetadataKeys.CreatePDBCommand, crossgen1CreatePDBCommand);
symbolsCompilationList.Add(pdbCompilationEntry);
@@ -236,8 +240,10 @@ private void ProcessInputFileList(
// This TaskItem corresponds to the output PDB image. It is equivalent to the input TaskItem, only the ItemSpec for it points to the new path
// for the newly created PDB image.
- TaskItem r2rSymbolsFileToPublish = new(file);
- r2rSymbolsFileToPublish.ItemSpec = outputPDBImage;
+ TaskItem r2rSymbolsFileToPublish = new(file)
+ {
+ ItemSpec = outputPDBImage
+ };
r2rSymbolsFileToPublish.SetMetadata(MetadataKeys.RelativePath, outputPDBImageRelativePath);
r2rSymbolsFileToPublish.RemoveMetadata(MetadataKeys.OriginalItemSpec);
if (!IncludeSymbolsInSingleFile)
@@ -257,8 +263,10 @@ private void ProcessInputFileList(
compositeR2RImageRelativePath = Path.ChangeExtension(compositeR2RImageRelativePath, "r2r" + Path.GetExtension(compositeR2RImageRelativePath));
var compositeR2RImage = Path.Combine(OutputPath, compositeR2RImageRelativePath);
- TaskItem r2rCompilationEntry = new(MainAssembly);
- r2rCompilationEntry.ItemSpec = r2rCompositeInputList[0].ItemSpec;
+ TaskItem r2rCompilationEntry = new(MainAssembly)
+ {
+ ItemSpec = r2rCompositeInputList[0].ItemSpec
+ };
r2rCompilationEntry.SetMetadata(MetadataKeys.OutputR2RImage, compositeR2RImage);
r2rCompilationEntry.SetMetadata(MetadataKeys.CreateCompositeImage, "true");
r2rCompilationEntry.RemoveMetadata(MetadataKeys.OriginalItemSpec);
@@ -288,8 +296,10 @@ private void ProcessInputFileList(
r2rCompilationEntry.SetMetadata(MetadataKeys.OutputPDBImage, compositePDBImage);
// Publish composite PDB file
- TaskItem r2rSymbolsFileToPublish = new(MainAssembly);
- r2rSymbolsFileToPublish.ItemSpec = compositePDBImage;
+ TaskItem r2rSymbolsFileToPublish = new(MainAssembly)
+ {
+ ItemSpec = compositePDBImage
+ };
r2rSymbolsFileToPublish.SetMetadata(MetadataKeys.RelativePath, compositePDBRelativePath);
r2rSymbolsFileToPublish.RemoveMetadata(MetadataKeys.OriginalItemSpec);
if (!IncludeSymbolsInSingleFile)
@@ -304,8 +314,10 @@ private void ProcessInputFileList(
imageCompilationList.Add(r2rCompilationEntry);
// Publish it
- TaskItem compositeR2RFileToPublish = new(MainAssembly);
- compositeR2RFileToPublish.ItemSpec = compositeR2RImage;
+ TaskItem compositeR2RFileToPublish = new(MainAssembly)
+ {
+ ItemSpec = compositeR2RImage
+ };
compositeR2RFileToPublish.RemoveMetadata(MetadataKeys.OriginalItemSpec);
compositeR2RFileToPublish.SetMetadata(MetadataKeys.RelativePath, compositeR2RImageRelativePath);
r2rFilesPublishList.Add(compositeR2RFileToPublish);
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ProjectContext.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ProjectContext.cs
index c6f5a73c72dd..55397bff9712 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/ProjectContext.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/ProjectContext.cs
@@ -99,7 +99,7 @@ public IEnumerable GetRuntimeLibraries(IEnumerable 0 && !String.Equals(PlatformLibrary.Name, NetCorePlatformLibrary, StringComparison.OrdinalIgnoreCase))
+ if (PlatformLibrary.Name.Length > 0 && !string.Equals(PlatformLibrary.Name, NetCorePlatformLibrary, StringComparison.OrdinalIgnoreCase))
{
var library = _lockFileTarget.GetLibrary(NetCorePlatformLibrary);
if (library != null)
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs
index e39f37e3886b..ef0fb44e85b9 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs
@@ -1813,7 +1813,7 @@ private void ComputePackageExclusions()
// If the platform library is not Microsoft.NETCore.App, treat it as an implicit dependency.
// This makes it so Microsoft.AspNet.* 2.x platforms also exclude Microsoft.NETCore.App files.
- if (!String.Equals(platformLibrary.Name, NetCorePlatformLibrary, StringComparison.OrdinalIgnoreCase))
+ if (!string.Equals(platformLibrary.Name, NetCorePlatformLibrary, StringComparison.OrdinalIgnoreCase))
{
var library = _runtimeTarget.GetLibrary(NetCorePlatformLibrary);
if (library != null)
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/RuntimePackAssetInfo.cs b/src/Tasks/Microsoft.NET.Build.Tasks/RuntimePackAssetInfo.cs
index 66e1ea3aa5cf..cefc0a2d5be2 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/RuntimePackAssetInfo.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/RuntimePackAssetInfo.cs
@@ -21,9 +21,11 @@ internal class RuntimePackAssetInfo
public static RuntimePackAssetInfo FromItem(ITaskItem item)
{
- var assetInfo = new RuntimePackAssetInfo();
- assetInfo.SourcePath = item.ItemSpec;
- assetInfo.DestinationSubPath = item.GetMetadata(MetadataKeys.DestinationSubPath);
+ var assetInfo = new RuntimePackAssetInfo
+ {
+ SourcePath = item.ItemSpec,
+ DestinationSubPath = item.GetMetadata(MetadataKeys.DestinationSubPath)
+ };
string assetTypeString = item.GetMetadata(MetadataKeys.AssetType);
if (assetTypeString.Equals("runtime", StringComparison.OrdinalIgnoreCase))
diff --git a/src/Tests/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs b/src/Tests/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs
index 737dceef4001..87f95c449cb7 100644
--- a/src/Tests/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs
+++ b/src/Tests/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs
@@ -136,7 +136,7 @@ private async Task> PrepareWorkItem(ITaskItem xunitProject)
msbuildAdditionalSdkResolverFolder = "";
}
- var scheduler = new AssemblyScheduler(methodLimit: !String.IsNullOrEmpty(Environment.GetEnvironmentVariable("TestFullMSBuild")) ? 32 : 16);
+ var scheduler = new AssemblyScheduler(methodLimit: !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TestFullMSBuild")) ? 32 : 16);
var assemblyPartitionInfos = scheduler.Schedule(targetPath, netFramework: netFramework);
var partitionedWorkItem = new List();
@@ -145,7 +145,7 @@ private async Task> PrepareWorkItem(ITaskItem xunitProject)
string command = $"{driver} exec {assemblyName} {testExecutionDirectory} {msbuildAdditionalSdkResolverFolder} {(XUnitArguments != null ? " " + XUnitArguments : "")} -xml testResults.xml {assemblyPartitionInfo.ClassListArgumentString} {arguments}";
if (netFramework)
{
- var testFilter = String.IsNullOrEmpty(assemblyPartitionInfo.ClassListArgumentString) ? "" : $"--filter \"{assemblyPartitionInfo.ClassListArgumentString}\"";
+ var testFilter = string.IsNullOrEmpty(assemblyPartitionInfo.ClassListArgumentString) ? "" : $"--filter \"{assemblyPartitionInfo.ClassListArgumentString}\"";
command = $"{driver} test {assemblyName} {testExecutionDirectory} {msbuildAdditionalSdkResolverFolder} {(XUnitArguments != null ? " " + XUnitArguments : "")} --results-directory .\\ --logger trx {testFilter}";
}
diff --git a/src/Tests/HelixTasks/TarGzFileCreateFromDirectory.cs b/src/Tests/HelixTasks/TarGzFileCreateFromDirectory.cs
index c84656185c45..737a5a16fa0c 100644
--- a/src/Tests/HelixTasks/TarGzFileCreateFromDirectory.cs
+++ b/src/Tests/HelixTasks/TarGzFileCreateFromDirectory.cs
@@ -134,7 +134,7 @@ private string GetDestinationArchive()
private string GetExcludes()
{
- var excludes = String.Empty;
+ var excludes = string.Empty;
if (ExcludePatterns != null)
{
diff --git a/src/Tests/Microsoft.DotNet.Cli.Utils.Tests/BlockingMemoryStreamTests.cs b/src/Tests/Microsoft.DotNet.Cli.Utils.Tests/BlockingMemoryStreamTests.cs
index 924d669c8280..7c913c16c703 100644
--- a/src/Tests/Microsoft.DotNet.Cli.Utils.Tests/BlockingMemoryStreamTests.cs
+++ b/src/Tests/Microsoft.DotNet.Cli.Utils.Tests/BlockingMemoryStreamTests.cs
@@ -83,9 +83,10 @@ public void TestReadBlocksUntilWrite()
Assert.Equal(3, buffer[2]);
readerThreadSuccessful = true;
- });
-
- readerThread.IsBackground = true;
+ })
+ {
+ IsBackground = true
+ };
readerThread.Start();
// ensure the thread is executing
diff --git a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs
index 5c58195a9c51..c1611a1cfcc1 100644
--- a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs
+++ b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs
@@ -27,7 +27,7 @@ public static string NewImageName([CallerMemberName] string callerMemberName = "
var (normalizedName, warning, error) = ContainerHelpers.NormalizeRepository(callerMemberName);
if (error is (var format, var args))
{
- throw new ArgumentException(String.Format(Strings.ResourceManager.GetString(format)!, args));
+ throw new ArgumentException(string.Format(Strings.ResourceManager.GetString(format)!, args));
}
return normalizedName!; // non-null if error is null
diff --git a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/TargetsTests.cs b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/TargetsTests.cs
index 2f90edad0631..c5bbb2567e19 100644
--- a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/TargetsTests.cs
+++ b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/TargetsTests.cs
@@ -19,7 +19,7 @@ public void CanDeferEntrypoint(string selfContainedPropertyName, bool selfContai
var (project, _, d) = ProjectInitializer.InitProject(new()
{
[selfContainedPropertyName] = selfContainedPropertyValue.ToString()
- }, projectName: $"{nameof(CanDeferEntrypoint)}_{selfContainedPropertyName}_{selfContainedPropertyValue}_{String.Join("_", entrypointArgs)}");
+ }, projectName: $"{nameof(CanDeferEntrypoint)}_{selfContainedPropertyName}_{selfContainedPropertyValue}_{string.Join("_", entrypointArgs)}");
using var _ = d;
Assert.True(project.Build(ComputeContainerConfig));
var computedEntrypointArgs = project.GetItems(ContainerEntrypoint).Select(i => i.EvaluatedInclude).ToArray();
@@ -59,7 +59,7 @@ public void CanNormalizeInputContainerNames(string projectName, string expectedC
}, projectName: $"{nameof(CanNormalizeInputContainerNames)}_{projectName}_{expectedContainerImageName}_{shouldPass}");
using var _ = d;
var instance = project.CreateProjectInstance(global::Microsoft.Build.Execution.ProjectInstanceSettings.None);
- instance.Build(new[] { ComputeContainerConfig }, new[] { logger }, null, out var outputs).Should().Be(shouldPass, String.Join(Environment.NewLine, logger.AllMessages));
+ instance.Build(new[] { ComputeContainerConfig }, new[] { logger }, null, out var outputs).Should().Be(shouldPass, string.Join(Environment.NewLine, logger.AllMessages));
Assert.Equal(expectedContainerImageName, instance.GetPropertyValue(ContainerRepository));
}
@@ -80,7 +80,7 @@ public void CanWarnOnInvalidSDKVersions(string sdkVersion, bool isAllowed)
using var _ = d;
var instance = project.CreateProjectInstance(global::Microsoft.Build.Execution.ProjectInstanceSettings.None);
instance.Build(new[] { "_ContainerVerifySDKVersion" }, new[] { logger }, null, out var outputs).Should().Be(isAllowed);
- var derivedIsAllowed = Boolean.Parse(project.GetProperty("_IsSDKContainerAllowedVersion").EvaluatedValue);
+ var derivedIsAllowed = bool.Parse(project.GetProperty("_IsSDKContainerAllowedVersion").EvaluatedValue);
if (isAllowed)
{
logger.Errors.Should().HaveCount(0, "an error should not have been created");
@@ -133,7 +133,7 @@ public void ShouldNotIncludeSourceControlLabelsUnlessUserOptsIn(bool includeSour
}, projectName: $"{nameof(ShouldNotIncludeSourceControlLabelsUnlessUserOptsIn)}_{includeSourceControl}");
using var _ = d;
var instance = project.CreateProjectInstance(global::Microsoft.Build.Execution.ProjectInstanceSettings.None);
- instance.Build(new[] { ComputeContainerConfig }, new[] { logger }, null, out var outputs).Should().BeTrue("Build should have succeeded but failed due to {0}", String.Join("\n", logger.AllMessages));
+ instance.Build(new[] { ComputeContainerConfig }, new[] { logger }, null, out var outputs).Should().BeTrue("Build should have succeeded but failed due to {0}", string.Join("\n", logger.AllMessages));
var labels = instance.GetItems(ContainerLabel);
if (includeSourceControl)
{
@@ -179,7 +179,7 @@ public void CanComputeTagsForSupportedSDKVersions(string sdkVersion, string tfm,
}, projectName: $"{nameof(CanComputeTagsForSupportedSDKVersions)}_{sdkVersion}_{tfm}_{expectedTag}");
using var _ = d;
var instance = project.CreateProjectInstance(global::Microsoft.Build.Execution.ProjectInstanceSettings.None);
- instance.Build(new[] { "_ComputeContainerBaseImageTag" }, new[] { logger }, null, out var outputs).Should().BeTrue(String.Join(Environment.NewLine, logger.Errors));
+ instance.Build(new[] { "_ComputeContainerBaseImageTag" }, new[] { logger }, null, out var outputs).Should().BeTrue(string.Join(Environment.NewLine, logger.Errors));
var computedTag = instance.GetProperty("_ContainerBaseImageTag").EvaluatedValue;
computedTag.Should().Be(expectedTag);
}
@@ -202,7 +202,7 @@ public void CanComputeContainerUser(string tfm, string rid, string expectedUser)
}, projectName: $"{nameof(CanComputeContainerUser)}_{tfm}_{rid}_{expectedUser}");
using var _ = d;
var instance = project.CreateProjectInstance(global::Microsoft.Build.Execution.ProjectInstanceSettings.None);
- instance.Build(new[] { ComputeContainerConfig }, new[] { logger }, null, out var outputs).Should().BeTrue(String.Join(Environment.NewLine, logger.Errors));
+ instance.Build(new[] { ComputeContainerConfig }, new[] { logger }, null, out var outputs).Should().BeTrue(string.Join(Environment.NewLine, logger.Errors));
var computedTag = instance.GetProperty("ContainerUser")?.EvaluatedValue;
computedTag.Should().Be(expectedUser);
}
@@ -221,7 +221,7 @@ public void WindowsUsersGetLinuxContainers(string sdkPortableRid, string expecte
}, projectName: $"{nameof(WindowsUsersGetLinuxContainers)}_{sdkPortableRid}_{expectedRid}");
using var _ = d;
var instance = project.CreateProjectInstance(global::Microsoft.Build.Execution.ProjectInstanceSettings.None);
- instance.Build(new[] { ComputeContainerConfig }, null, null, out var outputs).Should().BeTrue(String.Join(Environment.NewLine, logger.Errors));
+ instance.Build(new[] { ComputeContainerConfig }, null, null, out var outputs).Should().BeTrue(string.Join(Environment.NewLine, logger.Errors));
var computedRid = instance.GetProperty(KnownStrings.Properties.ContainerRuntimeIdentifier)?.EvaluatedValue;
computedRid.Should().Be(expectedRid);
}
@@ -243,7 +243,7 @@ public void CanTakeContainerBaseFamilyIntoAccount(string sdkVersion, string tfmM
}, projectName: $"{nameof(CanTakeContainerBaseFamilyIntoAccount)}_{sdkVersion}_{tfmMajMin}_{containerFamily}_{expectedTag}");
using var _ = d;
var instance = project.CreateProjectInstance(global::Microsoft.Build.Execution.ProjectInstanceSettings.None);
- instance.Build(new[] { _ComputeContainerBaseImageTag }, null, null, out var outputs).Should().BeTrue(String.Join(Environment.NewLine, logger.Errors));
+ instance.Build(new[] { _ComputeContainerBaseImageTag }, null, null, out var outputs).Should().BeTrue(string.Join(Environment.NewLine, logger.Errors));
var computedBaseImageTag = instance.GetProperty(KnownStrings.Properties._ContainerBaseImageTag)?.EvaluatedValue;
computedBaseImageTag.Should().Be(expectedTag);
}
diff --git a/src/Tests/Microsoft.NET.Build.Tests/ArtifactsOutputPathTests.cs b/src/Tests/Microsoft.NET.Build.Tests/ArtifactsOutputPathTests.cs
index 85a313508463..b1040d3c4bfe 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/ArtifactsOutputPathTests.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/ArtifactsOutputPathTests.cs
@@ -308,11 +308,10 @@ TestAsset CreateCustomizedTestProject(string propertyName, string propertyValue,
{
var testProject = new TestProject("App")
{
- IsExe = true
+ IsExe = true,
+ UseArtifactsOutput = true
};
- testProject.UseArtifactsOutput = true;
-
var testAsset = _testAssetsManager.CreateTestProjects(new[] { testProject }, callingMethod: callingMethod);
File.WriteAllText(Path.Combine(testAsset.Path, "Directory.Build.props"),
diff --git a/src/Tests/Microsoft.NET.Build.Tests/DesignTimeBuildTests.cs b/src/Tests/Microsoft.NET.Build.Tests/DesignTimeBuildTests.cs
index b209328166c9..9cbe12adb976 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/DesignTimeBuildTests.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/DesignTimeBuildTests.cs
@@ -41,8 +41,10 @@ public void The_design_time_build_succeeds_before_nuget_restore(string relativeP
var projectDirectory = Path.Combine(testAsset.TestRoot, relativeProjectPath);
- var command = new MSBuildCommand(Log, "ResolveAssemblyReferencesDesignTime", projectDirectory);
- command.WorkingDirectory = projectDirectory;
+ var command = new MSBuildCommand(Log, "ResolveAssemblyReferencesDesignTime", projectDirectory)
+ {
+ WorkingDirectory = projectDirectory
+ };
var result = command.Execute(args);
result.Should().Pass();
@@ -109,8 +111,10 @@ public void DesignTimePackageDependenciesAreResolved(string targetFramework)
var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework);
- var getValuesCommand = new GetValuesCommand(testAsset, "_PackageDependenciesDesignTime", GetValuesCommand.ValueType.Item);
- getValuesCommand.DependsOnTargets = "ResolvePackageDependenciesDesignTime";
+ var getValuesCommand = new GetValuesCommand(testAsset, "_PackageDependenciesDesignTime", GetValuesCommand.ValueType.Item)
+ {
+ DependsOnTargets = "ResolvePackageDependenciesDesignTime"
+ };
getValuesCommand.Execute()
.Should()
@@ -154,10 +158,12 @@ public void PackageErrorsAreSet(string targetFramework)
.Should()
.Fail();
- var getValuesCommand = new GetValuesCommand(testAsset, "_PackageDependenciesDesignTime", GetValuesCommand.ValueType.Item);
- getValuesCommand.ShouldRestore = false;
- getValuesCommand.DependsOnTargets = "ResolvePackageDependenciesDesignTime";
- getValuesCommand.MetadataNames = new List() { "DiagnosticLevel" };
+ var getValuesCommand = new GetValuesCommand(testAsset, "_PackageDependenciesDesignTime", GetValuesCommand.ValueType.Item)
+ {
+ ShouldRestore = false,
+ DependsOnTargets = "ResolvePackageDependenciesDesignTime",
+ MetadataNames = new List() { "DiagnosticLevel" }
+ };
getValuesCommand
.WithWorkingDirectory(testAsset.TestRoot)
@@ -206,8 +212,10 @@ private void TestDesignTimeBuildAfterChange(Action projectChange, [Ca
string projectFolder = Path.Combine(testAsset.TestRoot, testProject.Name);
- var buildCommand = new MSBuildCommand(Log, null, projectFolder);
- buildCommand.WorkingDirectory = projectFolder;
+ var buildCommand = new MSBuildCommand(Log, null, projectFolder)
+ {
+ WorkingDirectory = projectFolder
+ };
buildCommand
.Execute()
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs
index 57f6bdea0e31..a9144a87a2d0 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenFrameworkReferences.cs
@@ -842,8 +842,10 @@ public void ResolvedFrameworkReferences_are_generated()
};
var getValuesCommand = new GetValuesCommand(Log, projectFolder, testProject.TargetFrameworks,
- "ResolvedFrameworkReference", GetValuesCommand.ValueType.Item);
- getValuesCommand.DependsOnTargets = "ResolveFrameworkReferences";
+ "ResolvedFrameworkReference", GetValuesCommand.ValueType.Item)
+ {
+ DependsOnTargets = "ResolveFrameworkReferences"
+ };
getValuesCommand.MetadataNames.AddRange(expectedMetadata);
getValuesCommand.Execute().Should().Pass();
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeManifestSupportedFrameworks.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeManifestSupportedFrameworks.cs
index d02660379606..be9ba6ab5988 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeManifestSupportedFrameworks.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeManifestSupportedFrameworks.cs
@@ -107,9 +107,10 @@ private List GetItems(string testDirectory, string tfm, string itemName)
testDirectory,
tfm,
itemName,
- GetValuesCommand.ValueType.Item);
-
- command.DependsOnTargets = "";
+ GetValuesCommand.ValueType.Item)
+ {
+ DependsOnTargets = ""
+ };
command.Execute().Should().Pass();
return command.GetValues();
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildACrossTargetedLibrary.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildACrossTargetedLibrary.cs
index 8b49b2debd89..f84909d4f14d 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildACrossTargetedLibrary.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildACrossTargetedLibrary.cs
@@ -103,8 +103,10 @@ public void It_combines_inner_rids_for_restore(
new XElement(ns + "RuntimeIdentifiers", secondFrameworkRids)));
});
- var command = new GetValuesCommand(Log, testAsset.TestRoot, "", valueName: "RuntimeIdentifiers");
- command.DependsOnTargets = "GetAllRuntimeIdentifiers";
+ var command = new GetValuesCommand(Log, testAsset.TestRoot, "", valueName: "RuntimeIdentifiers")
+ {
+ DependsOnTargets = "GetAllRuntimeIdentifiers"
+ };
command.ExecuteWithoutRestore().Should().Pass();
command.GetValues().Should().BeEquivalentTo(expectedCombination.Split(';'));
}
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
index c8e7fc54833b..865805b4d129 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
@@ -283,10 +283,11 @@ public void It_implicitly_defines_compilation_constants_for_the_configuration(st
var libraryProjectDirectory = Path.Combine(testAsset.TestRoot, "TestLibrary");
var getValuesCommand = new GetValuesCommand(Log, libraryProjectDirectory,
- "netstandard1.5", "DefineConstants");
-
- getValuesCommand.ShouldCompile = true;
- getValuesCommand.Configuration = configuration;
+ "netstandard1.5", "DefineConstants")
+ {
+ ShouldCompile = true,
+ Configuration = configuration
+ };
getValuesCommand
.Execute("/p:Configuration=" + configuration)
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithFSharp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithFSharp.cs
index 3a8a8ddb1681..97db7747bff4 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithFSharp.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithFSharp.cs
@@ -146,10 +146,11 @@ public void It_implicitly_defines_compilation_constants_for_the_configuration(st
var libraryProjectDirectory = Path.Combine(testAsset.TestRoot, "TestLibrary");
var getValuesCommand = new GetValuesCommand(Log, libraryProjectDirectory,
- "netstandard1.6", "DefineConstants");
-
- getValuesCommand.ShouldCompile = true;
- getValuesCommand.Configuration = configuration;
+ "netstandard1.6", "DefineConstants")
+ {
+ ShouldCompile = true,
+ Configuration = configuration
+ };
getValuesCommand
.Execute("/p:Configuration=" + configuration)
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSSupportedVersion.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSSupportedVersion.cs
index bced4ea70e22..49d54f39464f 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSSupportedVersion.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithOSSupportedVersion.cs
@@ -15,8 +15,10 @@ public void WhenPropertiesAreNotSetItShouldNotGenerateSupportedOSPlatformAttribu
TestProject testProject = SetUpProject();
var testAsset = _testAssetsManager.CreateTestProject(testProject);
- var runCommand = new DotnetCommand(Log, "run");
- runCommand.WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name);
+ var runCommand = new DotnetCommand(Log, "run")
+ {
+ WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name)
+ };
runCommand.Execute()
.Should()
.Pass()
@@ -38,8 +40,10 @@ public void WhenPropertiesAreSetItCanGenerateSupportedOSPlatformAttribute()
var testAsset = _testAssetsManager.CreateTestProject(testProject);
- var runCommand = new DotnetCommand(Log, "run");
- runCommand.WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name);
+ var runCommand = new DotnetCommand(Log, "run")
+ {
+ WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name)
+ };
runCommand.Execute()
.Should()
.Pass()
@@ -60,8 +64,10 @@ public void WhenSupportedOSPlatformVersionIsNotSetTargetPlatformVersionIsSetItCa
var testAsset = _testAssetsManager.CreateTestProject(testProject);
- var runCommand = new DotnetCommand(Log, "run");
- runCommand.WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name);
+ var runCommand = new DotnetCommand(Log, "run")
+ {
+ WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name)
+ };
runCommand.Execute()
.Should()
.Pass()
@@ -77,8 +83,10 @@ public void WhenUsingDefaultTargetPlatformVersionItCanGenerateSupportedOSPlatfor
var testAsset = _testAssetsManager.CreateTestProject(testProject);
- var runCommand = new DotnetCommand(Log, "run");
- runCommand.WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name);
+ var runCommand = new DotnetCommand(Log, "run")
+ {
+ WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name)
+ };
runCommand.Execute()
.Should()
.Pass()
@@ -95,8 +103,10 @@ public void WhenUsingTargetPlatformInTargetFrameworkItCanGenerateSupportedOSPlat
var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework);
- var runCommand = new DotnetCommand(Log, "run");
- runCommand.WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name);
+ var runCommand = new DotnetCommand(Log, "run")
+ {
+ WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name)
+ };
runCommand.Execute()
.Should()
.Pass()
@@ -112,8 +122,10 @@ public void WhenUsingZeroedSupportedOSPlatformVersionItCanGenerateSupportedOSPla
var testAsset = _testAssetsManager.CreateTestProject(testProject);
- var runCommand = new DotnetCommand(Log, "run");
- runCommand.WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name);
+ var runCommand = new DotnetCommand(Log, "run")
+ {
+ WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name)
+ };
runCommand.Execute()
.Should()
.Pass()
@@ -149,8 +161,10 @@ public void WhenTargetPlatformMinVersionIsSetForWindowsItIsUsedForTheSupportedOS
var testAsset = _testAssetsManager.CreateTestProject(testProject);
- var runCommand = new DotnetCommand(Log, "run");
- runCommand.WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name);
+ var runCommand = new DotnetCommand(Log, "run")
+ {
+ WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name)
+ };
runCommand.Execute()
.Should()
.Pass()
@@ -166,8 +180,10 @@ public void WhenTargetingWindowsSupportedOSVersionPropertySetsTargetPlatformMinV
var testAsset = _testAssetsManager.CreateTestProject(testProject);
- var runCommand = new DotnetCommand(Log, "run");
- runCommand.WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name);
+ var runCommand = new DotnetCommand(Log, "run")
+ {
+ WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name)
+ };
runCommand.Execute()
.Should()
.Pass()
@@ -193,8 +209,10 @@ public void WhenTargetingWindowsSupportedOSPlatformVersionPropertyIsPreferredOve
var testAsset = _testAssetsManager.CreateTestProject(testProject);
- var runCommand = new DotnetCommand(Log, "run");
- runCommand.WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name);
+ var runCommand = new DotnetCommand(Log, "run")
+ {
+ WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name)
+ };
runCommand.Execute()
.Should()
.Pass()
@@ -240,8 +258,10 @@ public void WhenNotTargetingWindowsTargetPlatformMinVersionPropertyIsIgnored()
var testAsset = _testAssetsManager.CreateTestProject(testProject);
- var runCommand = new DotnetCommand(Log, "run");
- runCommand.WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name);
+ var runCommand = new DotnetCommand(Log, "run")
+ {
+ WorkingDirectory = Path.Combine(testAsset.TestRoot, testProject.Name)
+ };
runCommand.Execute()
.Should()
.Pass()
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithVB.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithVB.cs
index cc6e90a7ed50..0ae219de93fb 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithVB.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibraryWithVB.cs
@@ -157,10 +157,11 @@ public void It_implicitly_defines_compilation_constants_for_the_configuration(st
var libraryProjectDirectory = Path.Combine(testAsset.TestRoot, "TestLibrary");
var getValuesCommand = new GetValuesCommand(Log, libraryProjectDirectory,
- "netstandard1.5", "FinalDefineConstants");
-
- getValuesCommand.ShouldCompile = true;
- getValuesCommand.Configuration = configuration;
+ "netstandard1.5", "FinalDefineConstants")
+ {
+ ShouldCompile = true,
+ Configuration = configuration
+ };
getValuesCommand
.Execute("/p:Configuration=" + configuration)
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs
index 2c719b558dc7..42594ccfe4a6 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs
@@ -160,10 +160,12 @@ public void It_resolves_runtimepack_from_packs_folder()
var testAsset = _testAssetsManager.CreateTestProject(testProject);
- var getValuesCommand = new GetValuesCommand(testAsset, "RuntimePack", GetValuesCommand.ValueType.Item);
- getValuesCommand.MetadataNames = new List() { "NuGetPackageId", "NuGetPackageVersion" };
- getValuesCommand.DependsOnTargets = "ProcessFrameworkReferences";
- getValuesCommand.ShouldRestore = false;
+ var getValuesCommand = new GetValuesCommand(testAsset, "RuntimePack", GetValuesCommand.ValueType.Item)
+ {
+ MetadataNames = new List() { "NuGetPackageId", "NuGetPackageVersion" },
+ DependsOnTargets = "ProcessFrameworkReferences",
+ ShouldRestore = false
+ };
getValuesCommand.Execute()
.Should()
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs
index ed2882e35088..bfdf2589dcca 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAWindowsDesktopProject.cs
@@ -455,9 +455,11 @@ public void ItUsesTheHighestMatchingWindowsSdkPackageVersion(string targetFramew
private string GetReferencedWindowsSdkVersion(TestAsset testAsset)
{
- var getValueCommand = new GetValuesCommand(testAsset, "PackageDownload", GetValuesCommand.ValueType.Item);
- getValueCommand.ShouldRestore = false;
- getValueCommand.DependsOnTargets = "_CheckForInvalidConfigurationAndPlatform;CollectPackageDownloads";
+ var getValueCommand = new GetValuesCommand(testAsset, "PackageDownload", GetValuesCommand.ValueType.Item)
+ {
+ ShouldRestore = false,
+ DependsOnTargets = "_CheckForInvalidConfigurationAndPlatform;CollectPackageDownloads"
+ };
getValueCommand.MetadataNames.Add("Version");
getValueCommand.Execute()
.Should()
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithLibrariesAndRid.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithLibrariesAndRid.cs
index ae47d39b56d8..a05d354f3651 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithLibrariesAndRid.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithLibrariesAndRid.cs
@@ -106,7 +106,7 @@ public void It_builds_a_framework_dependent_RID_specific_runnable_output()
$"libuv{FileConstants.DynamicLibSuffix}"
};
- outputDirectory.Should().OnlyHaveFiles(expectedFiles.Where(x => !String.IsNullOrEmpty(x)).ToList());
+ outputDirectory.Should().OnlyHaveFiles(expectedFiles.Where(x => !string.IsNullOrEmpty(x)).ToList());
new DotnetCommand(Log, Path.Combine(outputDirectory.FullName, "App.dll"))
.Execute()
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToReferenceAProject.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToReferenceAProject.cs
index 6519c7005ee6..7d8fe5102df5 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToReferenceAProject.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToReferenceAProject.cs
@@ -182,8 +182,10 @@ public void It_disables_copying_conflicting_transitive_content(bool copyConflict
var buildCommand = new BuildCommand(parentAsset);
buildCommand.Execute().Should().Pass();
- var getValuesCommand = new GetValuesCommand(Log, Path.Combine(parentAsset.Path, parentProject.Name), tfm, "ResultOutput");
- getValuesCommand.DependsOnTargets = "Build";
+ var getValuesCommand = new GetValuesCommand(Log, Path.Combine(parentAsset.Path, parentProject.Name), tfm, "ResultOutput")
+ {
+ DependsOnTargets = "Build"
+ };
getValuesCommand.Execute().Should().Pass();
var valuesResult = getValuesCommand.GetValuesWithMetadata().Select(pair => Path.GetFullPath(pair.value));
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToResolveConflicts.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToResolveConflicts.cs
index 89b615004a72..107986b3db78 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToResolveConflicts.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToResolveConflicts.cs
@@ -67,8 +67,10 @@ private void GetReferences(TestProject testProject, bool expectConflicts, out Li
projectFolder,
targetFramework,
"Reference",
- GetValuesCommand.ValueType.Item);
- getReferenceCommand.DependsOnTargets = "Build";
+ GetValuesCommand.ValueType.Item)
+ {
+ DependsOnTargets = "Build"
+ };
var result = getReferenceCommand.Execute("/v:detailed").Should().Pass();
if (expectConflicts)
{
@@ -86,8 +88,10 @@ private void GetReferences(TestProject testProject, bool expectConflicts, out Li
projectFolder,
targetFramework,
"ReferenceCopyLocalPaths",
- GetValuesCommand.ValueType.Item);
- getReferenceCopyLocalPathsCommand.DependsOnTargets = "Build";
+ GetValuesCommand.ValueType.Item)
+ {
+ DependsOnTargets = "Build"
+ };
getReferenceCopyLocalPathsCommand.Execute().Should().Pass();
referenceCopyLocalPaths = getReferenceCopyLocalPathsCommand.GetValues();
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs
index edb8ebc6a11f..2b9007eb136e 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs
@@ -239,9 +239,10 @@ public void It_resolves_multitargeted_analyzers()
var getValuesCommand = new GetValuesCommand(testAsset,
valueName: "Analyzer",
GetValuesCommand.ValueType.Item,
- targetFramework);
-
- getValuesCommand.DependsOnTargets = "ResolveLockFileAnalyzers";
+ targetFramework)
+ {
+ DependsOnTargets = "ResolveLockFileAnalyzers"
+ };
getValuesCommand.Execute("-p:TargetFramework=" + targetFramework).Should().Pass();
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenTransitiveFrameworkReferencesAreDisabled.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenTransitiveFrameworkReferencesAreDisabled.cs
index 62619a18073b..e37427a2cb92 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenTransitiveFrameworkReferencesAreDisabled.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenTransitiveFrameworkReferencesAreDisabled.cs
@@ -150,14 +150,13 @@ public void TransitiveFrameworkReferenceGeneratesRuntimePackError()
referencedProject.FrameworkReferences.Add("Microsoft.AspNetCore.App");
- var testProject = new TestProject()
+ var testProject = new TestProject
{
TargetFrameworks = ToolsetInfo.CurrentTargetFramework,
IsExe = true,
- SelfContained = "true"
+ SelfContained = "true",
+ RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid()
};
-
- testProject.RuntimeIdentifier = EnvironmentInfo.GetCompatibleRid();
testProject.AdditionalProperties["DisableTransitiveFrameworkReferenceDownloads"] = "True";
testProject.AdditionalProperties["RestorePackagesPath"] = nugetPackagesFolder;
diff --git a/src/Tests/Microsoft.NET.Build.Tests/WorkloadTests.cs b/src/Tests/Microsoft.NET.Build.Tests/WorkloadTests.cs
index aa93bbfd6667..880b3b224a16 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/WorkloadTests.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/WorkloadTests.cs
@@ -61,8 +61,10 @@ public void It_should_create_suggested_workload_items()
var testAsset = _testAssetsManager
.CreateTestProject(testProject);
- var getValuesCommand = new GetValuesCommand(testAsset, "SuggestedWorkload", GetValuesCommand.ValueType.Item);
- getValuesCommand.DependsOnTargets = "GetSuggestedWorkloads";
+ var getValuesCommand = new GetValuesCommand(testAsset, "SuggestedWorkload", GetValuesCommand.ValueType.Item)
+ {
+ DependsOnTargets = "GetSuggestedWorkloads"
+ };
getValuesCommand.MetadataNames.Add("VisualStudioComponentId");
getValuesCommand.MetadataNames.Add("VisualStudioComponentIds");
getValuesCommand.ShouldRestore = false;
@@ -242,9 +244,11 @@ public void It_should_get_suggested_workload_by_GetRequiredWorkloads_target()
.CreateTestProject(mainProject);
var getValuesCommand =
- new GetValuesCommand(testAsset, "_ResolvedSuggestedWorkload", GetValuesCommand.ValueType.Item);
- getValuesCommand.DependsOnTargets = "_GetRequiredWorkloads";
- getValuesCommand.ShouldRestore = false;
+ new GetValuesCommand(testAsset, "_ResolvedSuggestedWorkload", GetValuesCommand.ValueType.Item)
+ {
+ DependsOnTargets = "_GetRequiredWorkloads",
+ ShouldRestore = false
+ };
getValuesCommand.Execute("/p:SkipResolvePackageAssets=true")
.Should()
@@ -290,9 +294,11 @@ public void Given_multi_target_It_should_get_suggested_workload_by_GetRequiredWo
.CreateTestProject(mainProject, identifier: mainTfm + "_" + referencingTfm);
var getValuesCommand =
- new GetValuesCommand(testAsset, "_ResolvedSuggestedWorkload", GetValuesCommand.ValueType.Item);
- getValuesCommand.DependsOnTargets = "_GetRequiredWorkloads";
- getValuesCommand.ShouldRestore = false;
+ new GetValuesCommand(testAsset, "_ResolvedSuggestedWorkload", GetValuesCommand.ValueType.Item)
+ {
+ DependsOnTargets = "_GetRequiredWorkloads",
+ ShouldRestore = false
+ };
getValuesCommand.Execute("/p:SkipResolvePackageAssets=true")
.Should()
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs
index e259797d1dee..fc7e71781cee 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs
@@ -94,7 +94,7 @@ public void It_can_make_a_Windows_GUI_exe()
targetFramework: TargetFramework,
runtimeIdentifier: runtimeIdentifier).FullName;
byte[] fileContent = File.ReadAllBytes(Path.Combine(outputDirectory, TestProjectName + ".exe"));
- UInt32 peHeaderOffset = BitConverter.ToUInt32(fileContent, PEHeaderPointerOffset);
+ uint peHeaderOffset = BitConverter.ToUInt32(fileContent, PEHeaderPointerOffset);
BitConverter
.ToUInt16(fileContent, (int)(peHeaderOffset + SubsystemOffset))
.Should()
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToStoreAProjectWithDependencies.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToStoreAProjectWithDependencies.cs
index bc02d0fcadbf..b315e318c856 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToStoreAProjectWithDependencies.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToStoreAProjectWithDependencies.cs
@@ -159,8 +159,10 @@ public void compose_multifile()
.CopyTestAsset("TargetManifests", "multifile")
.WithSource();
- var storeCommand = new ComposeStoreCommand(Log, simpleDependenciesAsset.TestRoot, "NewtonsoftFilterProfile.xml");
- storeCommand.WorkingDirectory = simpleDependenciesAsset.Path;
+ var storeCommand = new ComposeStoreCommand(Log, simpleDependenciesAsset.TestRoot, "NewtonsoftFilterProfile.xml")
+ {
+ WorkingDirectory = simpleDependenciesAsset.Path
+ };
var OutputFolder = Path.Combine(simpleDependenciesAsset.TestRoot, "o");
var WorkingDir = Path.Combine(simpleDependenciesAsset.TestRoot, "w");
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToTestAMultitargetedSolutionWithPublishReleaseOrPackRelease.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToTestAMultitargetedSolutionWithPublishReleaseOrPackRelease.cs
index 9ef16e7e2917..5d4e2a068532 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToTestAMultitargetedSolutionWithPublishReleaseOrPackRelease.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToTestAMultitargetedSolutionWithPublishReleaseOrPackRelease.cs
@@ -41,7 +41,7 @@ public GivenThatWeWantToTestAMultitargetedSolutionWithPublishReleaseOrPackReleas
List testProjects = new();
var testProject = new TestProject("TestProject")
{
- TargetFrameworks = String.Join(";", exeProjTfms),
+ TargetFrameworks = string.Join(";", exeProjTfms),
IsExe = true
};
testProject.RecordProperties("Configuration", "Optimize", PReleaseProperty);
@@ -52,7 +52,7 @@ public GivenThatWeWantToTestAMultitargetedSolutionWithPublishReleaseOrPackReleas
var libraryProject = new TestProject("LibraryProject")
{
- TargetFrameworks = String.Join(";", libraryProjTfms),
+ TargetFrameworks = string.Join(";", libraryProjTfms),
IsExe = false
};
libraryProject.RecordProperties("Configuration", "Optimize", PReleaseProperty);
@@ -271,7 +271,7 @@ public void ItFailsIfNet7DefinesPublishReleaseFalseButNet8PlusDefinesNone()
.Should()
.Fail()
.And
- .HaveStdErrContaining(String.Format(Strings.SolutionProjectConfigurationsConflict, PublishRelease, "")); ;
+ .HaveStdErrContaining(string.Format(Strings.SolutionProjectConfigurationsConflict, PublishRelease, "")); ;
}
[Fact]
diff --git a/src/Tests/Microsoft.NET.Publish.Tests/PublishDepsFilePathTests.cs b/src/Tests/Microsoft.NET.Publish.Tests/PublishDepsFilePathTests.cs
index d67653cef8c7..e55975a3132b 100644
--- a/src/Tests/Microsoft.NET.Publish.Tests/PublishDepsFilePathTests.cs
+++ b/src/Tests/Microsoft.NET.Publish.Tests/PublishDepsFilePathTests.cs
@@ -41,7 +41,7 @@ public void PublishDepsFilePathIsEmptyForSingleFileApps()
var targetFramework = testProject.TargetFrameworks;
var publishDepsFilePath = GetPropertyValue(projectPath, targetFramework, "PublishDepsFilePath");
- String.IsNullOrEmpty(publishDepsFilePath).Should().BeTrue();
+ string.IsNullOrEmpty(publishDepsFilePath).Should().BeTrue();
}
string GetPropertyValue(string projectPath, string targetFramework, string property)
diff --git a/src/Tests/Microsoft.NET.Restore.Tests/RestoreWithOlderNuGet.cs b/src/Tests/Microsoft.NET.Restore.Tests/RestoreWithOlderNuGet.cs
index db45ecf0d89e..bd44491e3848 100644
--- a/src/Tests/Microsoft.NET.Restore.Tests/RestoreWithOlderNuGet.cs
+++ b/src/Tests/Microsoft.NET.Restore.Tests/RestoreWithOlderNuGet.cs
@@ -21,8 +21,10 @@ public void ItCanBuildProjectRestoredWithNuGet5_7()
var testAsset = _testAssetsManager.CreateTestProject(testProject);
- var restoreCommand = new NuGetExeRestoreCommand(Log, testAsset.Path, testProject.Name);
- restoreCommand.NuGetExeVersion = "5.7.0";
+ var restoreCommand = new NuGetExeRestoreCommand(Log, testAsset.Path, testProject.Name)
+ {
+ NuGetExeVersion = "5.7.0"
+ };
restoreCommand
// Workaround for CI machines where MSBuild workload resolver isn't enabled by default
.WithEnvironmentVariable("MSBuildEnableWorkloadResolver", "false")
diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIntegrationTest.cs b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIntegrationTest.cs
index dcdf8a758dfd..dc2dd85448a3 100644
--- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIntegrationTest.cs
+++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIntegrationTest.cs
@@ -739,7 +739,7 @@ public void Build_WithJiterpreter_Advanced()
private void BuildWasmMinimalAndValidateBootConfig((string name, string value)[] properties, Action validateBootConfig)
{
var testAppName = "BlazorWasmMinimal";
- var testInstance = CreateAspNetSdkTestAsset(testAppName, identifier: String.Join("-", properties.Select(p => p.name + p.value ?? "null")));
+ var testInstance = CreateAspNetSdkTestAsset(testAppName, identifier: string.Join("-", properties.Select(p => p.name + p.value ?? "null")));
foreach (var property in properties)
{
diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/ApplyCssScopesTest.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/ApplyCssScopesTest.cs
index 8ce75bfa6d3e..fbbbc61f9777 100644
--- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/ApplyCssScopesTest.cs
+++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/ApplyCssScopesTest.cs
@@ -130,7 +130,7 @@ public void DoesNotApplyCssScopes_ToRazorViewsWithoutAssociatedFiles()
public void ApplyAllCssScopes_FailsWhenTheScopedCss_DoesNotMatchTheRazorComponent()
{
// Arrange
- var taskInstance = new ApplyCssScopes()
+ var taskInstance = new ApplyCssScopes
{
RazorComponents = new[]
{
@@ -143,11 +143,10 @@ public void ApplyAllCssScopes_FailsWhenTheScopedCss_DoesNotMatchTheRazorComponen
new TaskItem("TestFiles/Pages/Index.razor.css", new Dictionary { ["CssScope"] = "index-scope" }),
new TaskItem("TestFiles/Pages/Counter.razor.css", new Dictionary { ["CssScope"] = "counter-scope" }),
new TaskItem("TestFiles/Pages/Profile.razor.css", new Dictionary { ["CssScope"] = "profile-scope" }),
- }
+ },
+ BuildEngine = Mock.Of()
};
- taskInstance.BuildEngine = Mock.Of();
-
// Act
var result = taskInstance.Execute();
@@ -159,7 +158,7 @@ public void ApplyAllCssScopes_FailsWhenTheScopedCss_DoesNotMatchTheRazorComponen
public void ApplyAllCssScopes_FailsWhenTheScopedCss_DoesNotMatchTheRazorView()
{
// Arrange
- var taskInstance = new ApplyCssScopes()
+ var taskInstance = new ApplyCssScopes
{
RazorGenerate = new[]
{
@@ -172,11 +171,10 @@ public void ApplyAllCssScopes_FailsWhenTheScopedCss_DoesNotMatchTheRazorView()
new TaskItem("TestFiles/Pages/Index.cshtml.css", new Dictionary { ["CssScope"] = "index-scope" }),
new TaskItem("TestFiles/Pages/Counter.cshtml.css", new Dictionary { ["CssScope"] = "counter-scope" }),
new TaskItem("TestFiles/Pages/Profile.cshtml.css", new Dictionary { ["CssScope"] = "profile-scope" }),
- }
+ },
+ BuildEngine = Mock.Of()
};
- taskInstance.BuildEngine = Mock.Of();
-
// Act
var result = taskInstance.Execute();
@@ -246,7 +244,7 @@ public void ScopedCssCanDefineAssociatedRazorGenerateFile()
public void ApplyAllCssScopes_FailsWhenMultipleScopedCssFiles_MatchTheSameRazorComponent()
{
// Arrange
- var taskInstance = new ApplyCssScopes()
+ var taskInstance = new ApplyCssScopes
{
RazorComponents = new[]
{
@@ -263,11 +261,10 @@ public void ApplyAllCssScopes_FailsWhenMultipleScopedCssFiles_MatchTheSameRazorC
["CssScope"] = "conflict-scope",
["RazorComponent"] = "TestFiles/Pages/Index.razor"
}),
- }
+ },
+ BuildEngine = Mock.Of()
};
- taskInstance.BuildEngine = Mock.Of();
-
// Act
var result = taskInstance.Execute();
@@ -279,7 +276,7 @@ public void ApplyAllCssScopes_FailsWhenMultipleScopedCssFiles_MatchTheSameRazorC
public void ApplyAllCssScopes_FailsWhenMultipleScopedCssFiles_MatchTheSameRazorView()
{
// Arrange
- var taskInstance = new ApplyCssScopes()
+ var taskInstance = new ApplyCssScopes
{
RazorGenerate = new[]
{
@@ -296,11 +293,10 @@ public void ApplyAllCssScopes_FailsWhenMultipleScopedCssFiles_MatchTheSameRazorV
["CssScope"] = "conflict-scope",
["View"] = "TestFiles/Pages/Index.cshtml"
}),
- }
+ },
+ BuildEngine = Mock.Of()
};
- taskInstance.BuildEngine = Mock.Of();
-
// Act
var result = taskInstance.Execute();
@@ -351,7 +347,7 @@ public void ApplyAllCssScopes_AppliesScopesToRazorComponentAndViewFiles()
public void ApplyAllCssScopes_ScopedCssComponentsDontMatchWithScopedCssViewStylesAndViceversa()
{
// Arrange
- var taskInstance = new ApplyCssScopes()
+ var taskInstance = new ApplyCssScopes
{
RazorComponents = new[]
{
@@ -369,11 +365,10 @@ public void ApplyAllCssScopes_ScopedCssComponentsDontMatchWithScopedCssViewStyle
new TaskItem("TestFiles/Pages/_Host.razor.css", new Dictionary { ["CssScope"] = "_host-scope" }),
new TaskItem("TestFiles/Pages/Index.cshtml.css", new Dictionary { ["CssScope"] = "index-scope" }),
new TaskItem("TestFiles/Pages/Counter.cshtml.css", new Dictionary { ["CssScope"] = "counter-scope" }),
- }
+ },
+ BuildEngine = Mock.Of()
};
- taskInstance.BuildEngine = Mock.Of();
-
// Act
var result = taskInstance.Execute();
diff --git a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/GenerateStaticWebAssetsManifestTest.cs b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/GenerateStaticWebAssetsManifestTest.cs
index f5955ab8e94b..5e2e07b2e6cf 100644
--- a/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/GenerateStaticWebAssetsManifestTest.cs
+++ b/src/Tests/Microsoft.NET.Sdk.Razor.Tests/StaticWebAssets/GenerateStaticWebAssetsManifestTest.cs
@@ -315,16 +315,18 @@ private StaticWebAssetsManifest.ReferencedProjectConfiguration CreateProjectRefe
string additionalBuildProperties = ";",
string additionalBuildPropertiesToRemove = ";WebPublishProfileFile")
{
- var result = new StaticWebAssetsManifest.ReferencedProjectConfiguration();
- result.Identity = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), $"{source}.csproj"));
- result.Version = version;
- result.Source = source;
- result.GetPublishAssetsTargets = publishTargets;
- result.AdditionalPublishProperties = additionalPublishProperties;
- result.AdditionalPublishPropertiesToRemove = additionalPublishPropertiesToRemove;
- result.GetBuildAssetsTargets = buildTargets;
- result.AdditionalBuildProperties = additionalBuildProperties;
- result.AdditionalBuildPropertiesToRemove = additionalBuildPropertiesToRemove;
+ var result = new StaticWebAssetsManifest.ReferencedProjectConfiguration
+ {
+ Identity = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), $"{source}.csproj")),
+ Version = version,
+ Source = source,
+ GetPublishAssetsTargets = publishTargets,
+ AdditionalPublishProperties = additionalPublishProperties,
+ AdditionalPublishPropertiesToRemove = additionalPublishPropertiesToRemove,
+ GetBuildAssetsTargets = buildTargets,
+ AdditionalBuildProperties = additionalBuildProperties,
+ AdditionalBuildPropertiesToRemove = additionalBuildPropertiesToRemove
+ };
return result;
}
diff --git a/src/Tests/Microsoft.NET.Sdk.WorkloadManifestReader.Tests/WorkloadPackGroupTests.cs b/src/Tests/Microsoft.NET.Sdk.WorkloadManifestReader.Tests/WorkloadPackGroupTests.cs
index 92632543a5d5..8dce2302d652 100644
--- a/src/Tests/Microsoft.NET.Sdk.WorkloadManifestReader.Tests/WorkloadPackGroupTests.cs
+++ b/src/Tests/Microsoft.NET.Sdk.WorkloadManifestReader.Tests/WorkloadPackGroupTests.cs
@@ -184,10 +184,11 @@ List GetPackGroups()
WorkloadPackGroupJson ConvertGroupToJson(WorkloadPackGroup group)
{
- var groupJson = new WorkloadPackGroupJson();
-
- groupJson.GroupPackageId = group.Workload.Id + ".Packs";
- groupJson.GroupPackageVersion = group.WorkloadManifestVersion;
+ var groupJson = new WorkloadPackGroupJson
+ {
+ GroupPackageId = group.Workload.Id + ".Packs",
+ GroupPackageVersion = group.WorkloadManifestVersion
+ };
foreach (var pack in group.Packs)
{
diff --git a/src/Tests/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs b/src/Tests/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs
index 1f397b66e283..264dd4a1fdbc 100644
--- a/src/Tests/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs
+++ b/src/Tests/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs
@@ -17,7 +17,7 @@ private static string NormalizeLineEndings(string s)
public static AndConstraint BeVisuallyEquivalentTo(this StringAssertions assertions, string expected, string because = "", params object[] becauseArgs)
{
Execute.Assertion
- .ForCondition(String.Compare(NormalizeLineEndings(assertions.Subject), NormalizeLineEndings(expected), CultureInfo.CurrentCulture, CompareOptions.IgnoreSymbols) == 0)
+ .ForCondition(string.Compare(NormalizeLineEndings(assertions.Subject), NormalizeLineEndings(expected), CultureInfo.CurrentCulture, CompareOptions.IgnoreSymbols) == 0)
.BecauseOf(because, becauseArgs)
.FailWith($"String \"{assertions.Subject}\" is not visually equivalent to expected string \"{expected}\".");
diff --git a/src/Tests/Microsoft.NET.TestFramework/Commands/SdkCommandSpec.cs b/src/Tests/Microsoft.NET.TestFramework/Commands/SdkCommandSpec.cs
index d4f0f747bfab..ee8c0055b82e 100644
--- a/src/Tests/Microsoft.NET.TestFramework/Commands/SdkCommandSpec.cs
+++ b/src/Tests/Microsoft.NET.TestFramework/Commands/SdkCommandSpec.cs
@@ -36,10 +36,12 @@ public Command ToCommand(bool doNotEscapeArguments = false)
public ProcessStartInfo ToProcessStartInfo(bool doNotEscapeArguments = false)
{
- var ret = new ProcessStartInfo();
- ret.FileName = FileName;
- ret.Arguments = doNotEscapeArguments ? string.Join(" ", Arguments) : EscapeArgs();
- ret.UseShellExecute = false;
+ var ret = new ProcessStartInfo
+ {
+ FileName = FileName,
+ Arguments = doNotEscapeArguments ? string.Join(" ", Arguments) : EscapeArgs(),
+ UseShellExecute = false
+ };
foreach (var kvp in Environment)
{
ret.Environment[kvp.Key] = kvp.Value;
diff --git a/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs b/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs
index 6e28bec5f1aa..d3fbb0dfa379 100644
--- a/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs
+++ b/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs
@@ -278,7 +278,7 @@ internal void Create(TestAsset targetTestAsset, string testProjectsSourceFolder,
if (SelfContained != "")
{
- propertyGroup.Add(new XElement(ns + "SelfContained", String.Equals(SelfContained, "true", StringComparison.OrdinalIgnoreCase) ? "true" : "false"));
+ propertyGroup.Add(new XElement(ns + "SelfContained", string.Equals(SelfContained, "true", StringComparison.OrdinalIgnoreCase) ? "true" : "false"));
}
if (ReferencedProjects.Any())
@@ -497,7 +497,7 @@ public Dictionary GetPropertyValues(string testRoot, string targ
if (colonIndex > 0)
{
string propertyName = line.Substring(0, colonIndex);
- string propertyValue = line.Length == colonIndex + 1 ? String.Empty : line.Substring(colonIndex + 2);
+ string propertyValue = line.Length == colonIndex + 1 ? string.Empty : line.Substring(colonIndex + 2);
propertyValues[propertyName] = propertyValue;
}
}
diff --git a/src/Tests/Microsoft.NET.TestFramework/TestAssetsManager.cs b/src/Tests/Microsoft.NET.TestFramework/TestAssetsManager.cs
index c4b8cbe5b065..8340ad2e0c75 100644
--- a/src/Tests/Microsoft.NET.TestFramework/TestAssetsManager.cs
+++ b/src/Tests/Microsoft.NET.TestFramework/TestAssetsManager.cs
@@ -10,7 +10,7 @@ public class TestAssetsManager
{
public string TestAssetsRoot { get; private set; }
- private List TestDestinationDirectories { get; } = new List();
+ private List TestDestinationDirectories { get; } = new List();
protected ITestOutputHelper Log { get; }
diff --git a/src/Tests/Microsoft.NET.TestFramework/TestCommandLine.cs b/src/Tests/Microsoft.NET.TestFramework/TestCommandLine.cs
index 770ca9a970f6..f873ca8fab23 100644
--- a/src/Tests/Microsoft.NET.TestFramework/TestCommandLine.cs
+++ b/src/Tests/Microsoft.NET.TestFramework/TestCommandLine.cs
@@ -37,8 +37,10 @@ public class TestCommandLine
public static TestCommandLine Parse(string[] args)
{
- TestCommandLine ret = new();
- ret.RemainingArgs = new List();
+ TestCommandLine ret = new()
+ {
+ RemainingArgs = new List()
+ };
Stack argStack = new(args.Reverse());
while (argStack.Any())
@@ -210,9 +212,10 @@ private class TestList
public static TestList Parse(XElement element)
{
- TestList group = new();
-
- group.Name = element.Attribute("Name")?.Value;
+ TestList group = new()
+ {
+ Name = element.Attribute("Name")?.Value
+ };
foreach (var item in element.Elements())
{
diff --git a/src/Tests/Microsoft.NET.TestFramework/TestDirectory.cs b/src/Tests/Microsoft.NET.TestFramework/TestDirectory.cs
index 28fabfd71e70..543e415c84eb 100644
--- a/src/Tests/Microsoft.NET.TestFramework/TestDirectory.cs
+++ b/src/Tests/Microsoft.NET.TestFramework/TestDirectory.cs
@@ -31,8 +31,10 @@ private static void EnsureExistsAndEmpty(string path, string sdkVersion)
try
{
// Clear read-only flags on anything in the directory
- var dirInfo = new DirectoryInfo(path);
- dirInfo.Attributes = FileAttributes.Normal;
+ var dirInfo = new DirectoryInfo(path)
+ {
+ Attributes = FileAttributes.Normal
+ };
foreach (var info in dirInfo.GetFileSystemInfos("*", SearchOption.AllDirectories))
{
info.Attributes = FileAttributes.Normal;
diff --git a/src/Tests/Microsoft.NET.TestFramework/TestPackageReference.cs b/src/Tests/Microsoft.NET.TestFramework/TestPackageReference.cs
index e44a279ae3d3..f58a57ba3991 100644
--- a/src/Tests/Microsoft.NET.TestFramework/TestPackageReference.cs
+++ b/src/Tests/Microsoft.NET.TestFramework/TestPackageReference.cs
@@ -25,7 +25,7 @@ public TestPackageReference(string id, string version = null, string nupkgPath =
public bool UpdatePackageReference { get; private set; }
public bool NuGetPackageExists()
{
- return File.Exists(Path.Combine(NupkgPath, String.Concat(ID + "." + Version + ".nupkg")));
+ return File.Exists(Path.Combine(NupkgPath, string.Concat(ID + "." + Version + ".nupkg")));
}
}
}
diff --git a/src/Tests/Microsoft.NET.TestFramework/ToolsetInfo.cs b/src/Tests/Microsoft.NET.TestFramework/ToolsetInfo.cs
index 0049169f56e8..5cfce2bcd7c5 100644
--- a/src/Tests/Microsoft.NET.TestFramework/ToolsetInfo.cs
+++ b/src/Tests/Microsoft.NET.TestFramework/ToolsetInfo.cs
@@ -88,9 +88,10 @@ private void InitSdkVersion()
{
FullFrameworkMSBuildPath = null;
var logger = new StringTestLogger();
- var command = new DotnetCommand(logger, "--version");
-
- command.WorkingDirectory = TestContext.Current.TestExecutionDirectory;
+ var command = new DotnetCommand(logger, "--version")
+ {
+ WorkingDirectory = TestContext.Current.TestExecutionDirectory
+ };
var result = command.Execute();
@@ -110,9 +111,10 @@ private void InitSdkVersion()
private void InitMSBuildVersion()
{
var logger = new StringTestLogger();
- var command = new MSBuildVersionCommand(logger);
-
- command.WorkingDirectory = TestContext.Current.TestExecutionDirectory;
+ var command = new MSBuildVersionCommand(logger)
+ {
+ WorkingDirectory = TestContext.Current.TestExecutionDirectory
+ };
var result = command.Execute();
diff --git a/src/Tests/Microsoft.Win32.Msi.Manual.Tests/Program.cs b/src/Tests/Microsoft.Win32.Msi.Manual.Tests/Program.cs
index 03f80d2e73d9..d475409f56d8 100644
--- a/src/Tests/Microsoft.Win32.Msi.Manual.Tests/Program.cs
+++ b/src/Tests/Microsoft.Win32.Msi.Manual.Tests/Program.cs
@@ -104,7 +104,7 @@ void ClearLine()
Console.SetCursorPosition(0, top);
}
- void OnActionData(Object sender, ActionDataEventArgs e)
+ void OnActionData(object sender, ActionDataEventArgs e)
{
if (ActionDataEnabled)
{
@@ -115,7 +115,7 @@ void OnActionData(Object sender, ActionDataEventArgs e)
e.Result = DialogResult.IDOK;
}
- void OnActionStart(Object send, ActionStartEventArgs e)
+ void OnActionStart(object send, ActionStartEventArgs e)
{
if (ActionDataEnabled)
{
@@ -134,7 +134,7 @@ void OnActionStart(Object send, ActionStartEventArgs e)
e.Result = DialogResult.IDOK;
}
- void OnProgress(Object send, ProgressEventArgs e)
+ void OnProgress(object send, ProgressEventArgs e)
{
e.Result = DialogResult.IDOK;
diff --git a/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsVbProj.cs b/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsVbProj.cs
index da047095d427..cd39acaa7629 100644
--- a/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsVbProj.cs
+++ b/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsVbProj.cs
@@ -46,7 +46,7 @@ public void ItFailsWhenTryingToUseLaunchProfileSharingTheSameNameWithAnotherProf
.WithWorkingDirectory(testInstance.Path)
.Execute("--launch-profile", "first");
- string expectedError = String.Format(LocalizableStrings.DuplicateCaseInsensitiveLaunchProfileNames, "\tfirst," + (OperatingSystem.IsWindows() ? "\r" : "") + "\n\tFIRST");
+ string expectedError = string.Format(LocalizableStrings.DuplicateCaseInsensitiveLaunchProfileNames, "\tfirst," + (OperatingSystem.IsWindows() ? "\r" : "") + "\n\tFIRST");
runResult
.Should()
.Fail()
@@ -69,7 +69,7 @@ public void ItFailsWithSpecificErrorMessageIfLaunchProfileDoesntExist()
.Should()
.Pass()
.And
- .HaveStdErrContaining(String.Format(LocalizableStrings.LaunchProfileDoesNotExist, invalidLaunchProfileName));
+ .HaveStdErrContaining(string.Format(LocalizableStrings.LaunchProfileDoesNotExist, invalidLaunchProfileName));
}
[Theory]
diff --git a/src/Tests/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs b/src/Tests/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs
index c4de4235af8d..477672162967 100644
--- a/src/Tests/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs
+++ b/src/Tests/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs
@@ -241,7 +241,7 @@ public void TestWillCreateTrxLoggerInTheSpecifiedResultsDirectoryBySwitch()
.Execute("--logger", "trx", "--results-directory", trxLoggerDirectory);
// Verify
- String[] trxFiles = Directory.GetFiles(trxLoggerDirectory, "*.trx");
+ string[] trxFiles = Directory.GetFiles(trxLoggerDirectory, "*.trx");
Assert.Single(trxFiles);
result.StdOut.Should().Contain(trxFiles[0]);
diff --git a/src/Tests/dotnet-workload-install.Tests/GivenDotnetWorkloadInstall.cs b/src/Tests/dotnet-workload-install.Tests/GivenDotnetWorkloadInstall.cs
index e70abd5297c9..1ba573498b7e 100644
--- a/src/Tests/dotnet-workload-install.Tests/GivenDotnetWorkloadInstall.cs
+++ b/src/Tests/dotnet-workload-install.Tests/GivenDotnetWorkloadInstall.cs
@@ -37,7 +37,7 @@ public void GivenWorkloadInstallItErrorsOnFakeWorkloadName()
.Should()
.Fail()
.And
- .HaveStdErrContaining(String.Format(Workloads.Workload.Install.LocalizableStrings.WorkloadNotRecognized, "fake"));
+ .HaveStdErrContaining(string.Format(Workloads.Workload.Install.LocalizableStrings.WorkloadNotRecognized, "fake"));
}
[Fact(Skip = "https://github.com/dotnet/sdk/issues/26624")]
@@ -51,7 +51,7 @@ public void ItErrorUsingSkipManifestAndRollback()
.Should()
.Fail()
.And
- .HaveStdErrContaining(String.Format(Workloads.Workload.Install.LocalizableStrings.CannotCombineSkipManifestAndRollback, "skip-manifest-update", "from-rollback-file", "skip-manifest-update", "from-rollback-file"));
+ .HaveStdErrContaining(string.Format(Workloads.Workload.Install.LocalizableStrings.CannotCombineSkipManifestAndRollback, "skip-manifest-update", "from-rollback-file", "skip-manifest-update", "from-rollback-file"));
}
@@ -308,7 +308,6 @@ public void GivenWorkloadInstallItPrintsDownloadUrls(bool userLocal, string sdkV
installManager.Execute();
- _reporter.Lines.Should().Contain("==allPackageLinksJsonOutputStart==");
string.Join(" ", _reporter.Lines).Should().Contain("http://mock-url/xamarin.android.sdk.8.4.7.nupkg");
string.Join(" ", _reporter.Lines).Should().Contain("http://mock-url/mock-manifest-package.1.0.5.nupkg");
}
@@ -328,7 +327,7 @@ public void GivenWorkloadInstallItErrorsOnUnsupportedPlatform()
var exceptionThrown = Assert.Throws(() => new WorkloadInstallCommand(parseResult, reporter: _reporter, workloadResolver: workloadResolver, workloadInstaller: installer,
nugetPackageDownloader: nugetDownloader, workloadManifestUpdater: manifestUpdater, userProfileDir: testDirectory, dotnetDir: dotnetRoot, version: "6.0.100", installedFeatureBand: "6.0.100"));
- exceptionThrown.Message.Should().Be(String.Format(Workloads.Workload.Install.LocalizableStrings.WorkloadNotSupportedOnPlatform, mockWorkloadId));
+ exceptionThrown.Message.Should().Be(string.Format(Workloads.Workload.Install.LocalizableStrings.WorkloadNotSupportedOnPlatform, mockWorkloadId));
}
[Theory]
@@ -583,7 +582,7 @@ public void ShowManifestUpdatesWhenVerbosityIsDetailedOrDiagnostic(string verbos
installManager.InstallWorkloads(new List(), false); // Don't actually do any installs, just update manifests
string.Join(" ", _reporter.Lines).Should().Contain(Workloads.Workload.Install.LocalizableStrings.CheckForUpdatedWorkloadManifests);
- string.Join(" ", _reporter.Lines).Should().Contain(String.Format(Workloads.Workload.Install.LocalizableStrings.CheckForUpdatedWorkloadManifests, "mock-manifest"));
+ string.Join(" ", _reporter.Lines).Should().Contain(string.Format(Workloads.Workload.Install.LocalizableStrings.CheckForUpdatedWorkloadManifests, "mock-manifest"));
}
private string AppendForUserLocal(string identifier, bool userLocal)
diff --git a/src/Tests/dotnet-workload-install.Tests/GivenWorkloadManifestUpdater.cs b/src/Tests/dotnet-workload-install.Tests/GivenWorkloadManifestUpdater.cs
index aec297b76db5..6009cedbe541 100644
--- a/src/Tests/dotnet-workload-install.Tests/GivenWorkloadManifestUpdater.cs
+++ b/src/Tests/dotnet-workload-install.Tests/GivenWorkloadManifestUpdater.cs
@@ -186,8 +186,10 @@ public void GivenAdvertisedManifestsItCalculatesCorrectUpdates()
manifestId => (manifestId.ToString(), Path.Combine(testDir, "dotnet", "sdk-manifests", currentFeatureBand, manifestId.ToString(), "WorkloadManifest.json"), currentFeatureBand)))
.ToArray();
- var workloadManifestProvider = new MockManifestProvider(manifestInfo);
- workloadManifestProvider.SdkFeatureBand = new SdkFeatureBand(currentFeatureBand);
+ var workloadManifestProvider = new MockManifestProvider(manifestInfo)
+ {
+ SdkFeatureBand = new SdkFeatureBand(currentFeatureBand)
+ };
var nugetDownloader = new MockNuGetPackageDownloader(dotnetRoot);
var workloadResolver = WorkloadResolver.CreateForTests(workloadManifestProvider, dotnetRoot);
var installationRepo = new MockInstallationRecordRepository();
@@ -271,7 +273,7 @@ public void ItCanFallbackAndAdvertiseCorrectUpdate(bool useOfflineCache)
// check that update did not fail
_reporter.Lines.Should().NotContain(l => l.ToLowerInvariant().Contains("fail"));
- _reporter.Lines.Should().NotContain(String.Format(Workloads.Workload.Install.LocalizableStrings.AdManifestPackageDoesNotExist, testManifestName));
+ _reporter.Lines.Should().NotContain(string.Format(Workloads.Workload.Install.LocalizableStrings.AdManifestPackageDoesNotExist, testManifestName));
}
@@ -339,7 +341,7 @@ public void ItCanFallbackWithNoUpdates(bool useOfflineCache)
// Assert
_reporter.Lines.Should().NotContain(l => l.ToLowerInvariant().Contains("fail"));
- _reporter.Lines.Should().Contain(String.Format(Workloads.Workload.Install.LocalizableStrings.AdManifestPackageDoesNotExist, testManifestName));
+ _reporter.Lines.Should().Contain(string.Format(Workloads.Workload.Install.LocalizableStrings.AdManifestPackageDoesNotExist, testManifestName));
}
[Theory]
@@ -405,7 +407,7 @@ public void GivenNoUpdatesAreAvailableAndNoRollbackItGivesAppropriateMessage(boo
Directory.GetFiles(adManifestDir).Should().BeEmpty();
_reporter.Lines.Should().NotContain(l => l.ToLowerInvariant().Contains("fail"));
- _reporter.Lines.Should().Contain(String.Format(Workloads.Workload.Install.LocalizableStrings.AdManifestPackageDoesNotExist, testManifestName));
+ _reporter.Lines.Should().Contain(string.Format(Workloads.Workload.Install.LocalizableStrings.AdManifestPackageDoesNotExist, testManifestName));
}
[Fact]
diff --git a/src/Tests/dotnet-workload-update.Tests/GivenDotnetWorkloadUpdate.cs b/src/Tests/dotnet-workload-update.Tests/GivenDotnetWorkloadUpdate.cs
index 7fd04aec0e12..08b8c09c20a5 100644
--- a/src/Tests/dotnet-workload-update.Tests/GivenDotnetWorkloadUpdate.cs
+++ b/src/Tests/dotnet-workload-update.Tests/GivenDotnetWorkloadUpdate.cs
@@ -250,7 +250,6 @@ public void GivenWorkloadUpdateItPrintsDownloadUrls()
command.Execute();
- _reporter.Lines.Should().Contain("==allPackageLinksJsonOutputStart==");
string.Join(" ", _reporter.Lines).Should().Contain("http://mock-url/xamarin.android.templates.1.0.3.nupkg", "New pack urls should be included in output");
string.Join(" ", _reporter.Lines).Should().Contain("http://mock-url/xamarin.android.framework.8.4.0.nupkg", "Urls for packs with updated versions should be included in output");
string.Join(" ", _reporter.Lines).Should().NotContain("xamarin.android.sdk", "Urls for packs with the same version should not be included in output");
@@ -327,7 +326,7 @@ public void GivenPrintRollbackDefinitionItIncludesAllInstalledManifests()
updateCommand.Execute();
- _reporter.Lines.Count().Should().Be(3);
+ _reporter.Lines.Count().Should().Be(1);
string.Join("", _reporter.Lines).Should().Contain("samplemanifest");
}
diff --git a/src/WebSdk/Publish/Tasks/Kudu/KuduConnect.cs b/src/WebSdk/Publish/Tasks/Kudu/KuduConnect.cs
index 0e49f5fbdf71..914913e1f0e5 100644
--- a/src/WebSdk/Publish/Tasks/Kudu/KuduConnect.cs
+++ b/src/WebSdk/Publish/Tasks/Kudu/KuduConnect.cs
@@ -33,7 +33,7 @@ protected string AuthorizationInfo
{
lock (_syncObject)
{
- string authInfo = String.Format("{0}:{1}", _connectionInfo.UserName, _connectionInfo.Password);
+ string authInfo = string.Format("{0}:{1}", _connectionInfo.UserName, _connectionInfo.Password);
return Convert.ToBase64String(Encoding.UTF8.GetBytes(authInfo));
}
}
diff --git a/src/WebSdk/Publish/Tasks/Kudu/KuduVfsDeploy.cs b/src/WebSdk/Publish/Tasks/Kudu/KuduVfsDeploy.cs
index b5c3838e6000..9ec7f6327532 100644
--- a/src/WebSdk/Publish/Tasks/Kudu/KuduVfsDeploy.cs
+++ b/src/WebSdk/Publish/Tasks/Kudu/KuduVfsDeploy.cs
@@ -24,7 +24,7 @@ public override string DestinationUrl
{
get
{
- return String.Format(ConnectionInfo.DestinationUrl, ConnectionInfo.SiteName, "vfs/site/wwwroot/");
+ return string.Format(ConnectionInfo.DestinationUrl, ConnectionInfo.SiteName, "vfs/site/wwwroot/");
}
}
@@ -51,7 +51,7 @@ private System.Threading.Tasks.Task PostFilesAsync(string file, string sourcePat
return System.Threading.Tasks.Task.Run(
async () =>
{
- string relPath = file.Replace(sourcePath, String.Empty);
+ string relPath = file.Replace(sourcePath, string.Empty);
string relUrl = relPath.Replace(Path.DirectorySeparatorChar, '/');
string apiUrl = DestinationUrl + relUrl;
@@ -74,14 +74,14 @@ private System.Threading.Tasks.Task PostFilesAsync(string file, string sourcePat
{
lock (_syncObject)
{
- _logger.LogMessage(Microsoft.Build.Framework.MessageImportance.High, String.Format(Resources.KUDUDEPLOY_AddingFileFailed, ConnectionInfo.SiteName + "/" + relUrl, response.ReasonPhrase));
+ _logger.LogMessage(Microsoft.Build.Framework.MessageImportance.High, string.Format(Resources.KUDUDEPLOY_AddingFileFailed, ConnectionInfo.SiteName + "/" + relUrl, response.ReasonPhrase));
}
}
else
{
lock (_syncObject)
{
- _logger.LogMessage(Microsoft.Build.Framework.MessageImportance.High, String.Format(Resources.KUDUDEPLOY_AddingFile, ConnectionInfo.SiteName + "/" + relUrl));
+ _logger.LogMessage(Microsoft.Build.Framework.MessageImportance.High, string.Format(Resources.KUDUDEPLOY_AddingFile, ConnectionInfo.SiteName + "/" + relUrl));
}
}
}
diff --git a/src/WebSdk/Publish/Tasks/Kudu/KuduZipDeploy.cs b/src/WebSdk/Publish/Tasks/Kudu/KuduZipDeploy.cs
index 4cd09a605529..c2420fab9bb9 100644
--- a/src/WebSdk/Publish/Tasks/Kudu/KuduZipDeploy.cs
+++ b/src/WebSdk/Publish/Tasks/Kudu/KuduZipDeploy.cs
@@ -21,7 +21,7 @@ public override string DestinationUrl
{
get
{
- return String.Format(ConnectionInfo.DestinationUrl, ConnectionInfo.SiteName, "zip/site/wwwroot/");
+ return string.Format(ConnectionInfo.DestinationUrl, ConnectionInfo.SiteName, "zip/site/wwwroot/");
}
}
@@ -31,7 +31,7 @@ public async System.Threading.Tasks.Task DeployAsync(string zipFileFullPat
if (!File.Exists(zipFileFullPath))
{
// If the source file directory does not exist quit early.
- _logger.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, Resources.KUDUDEPLOY_DeployOutputPathEmpty));
+ _logger.LogError(string.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, Resources.KUDUDEPLOY_DeployOutputPathEmpty));
return false;
}
@@ -41,7 +41,7 @@ public async System.Threading.Tasks.Task DeployAsync(string zipFileFullPat
private async System.Threading.Tasks.Task PostZipAsync(string zipFilePath)
{
- if (String.IsNullOrEmpty(zipFilePath))
+ if (string.IsNullOrEmpty(zipFilePath))
{
return false;
}
@@ -63,7 +63,7 @@ private async System.Threading.Tasks.Task PostZipAsync(string zipFilePath)
{
if (!response.IsSuccessStatusCode)
{
- _logger.LogError(String.Format(Resources.KUDUDEPLOY_PublishZipFailedReason, ConnectionInfo.SiteName, response.ReasonPhrase));
+ _logger.LogError(string.Format(Resources.KUDUDEPLOY_PublishZipFailedReason, ConnectionInfo.SiteName, response.ReasonPhrase));
return false;
}
}
diff --git a/src/WebSdk/Publish/Tasks/MsDeploy/CommonUtility.cs b/src/WebSdk/Publish/Tasks/MsDeploy/CommonUtility.cs
index 125a520bd5ad..df2384d2b8f8 100644
--- a/src/WebSdk/Publish/Tasks/MsDeploy/CommonUtility.cs
+++ b/src/WebSdk/Publish/Tasks/MsDeploy/CommonUtility.cs
@@ -462,8 +462,10 @@ public static bool CheckMSDeploymentVersion(Utilities.TaskLoggingHelper log, out
public static void SaveDocument(Xml.XmlDocument document, string outputFileName, System.Text.Encoding encode)
{
#if NET472
- Xml.XmlTextWriter textWriter = new(outputFileName, encode);
- textWriter.Formatting = System.Xml.Formatting.Indented;
+ Xml.XmlTextWriter textWriter = new(outputFileName, encode)
+ {
+ Formatting = System.Xml.Formatting.Indented
+ };
document.Save(textWriter);
textWriter.Close();
#else
diff --git a/src/WebSdk/Publish/Tasks/Tasks/GenerateEFSQLScripts.cs b/src/WebSdk/Publish/Tasks/Tasks/GenerateEFSQLScripts.cs
index 6fbd2d935363..a93ad31a066d 100644
--- a/src/WebSdk/Publish/Tasks/Tasks/GenerateEFSQLScripts.cs
+++ b/src/WebSdk/Publish/Tasks/Tasks/GenerateEFSQLScripts.cs
@@ -99,9 +99,11 @@ private bool GenerateSQLScript(string sqlFileFullPath, string dbContextName, boo
Log.LogMessage(MessageImportance.High, string.Format("Executing command: {0} {1}", psi.FileName, psi.Arguments));
}
- proc = new Process();
- proc.StartInfo = psi;
- proc.EnableRaisingEvents = true;
+ proc = new Process
+ {
+ StartInfo = psi,
+ EnableRaisingEvents = true
+ };
proc.OutputDataReceived += Proc_OutputDataReceived;
proc.ErrorDataReceived += Proc_ErrorDataReceived;
proc.Exited += Proc_Exited;
diff --git a/src/WebSdk/Publish/Tasks/Tasks/Kudu/KuduDeploy.cs b/src/WebSdk/Publish/Tasks/Tasks/Kudu/KuduDeploy.cs
index b15fadb0b269..8e6f8ba2d37e 100644
--- a/src/WebSdk/Publish/Tasks/Tasks/Kudu/KuduDeploy.cs
+++ b/src/WebSdk/Publish/Tasks/Tasks/Kudu/KuduDeploy.cs
@@ -61,26 +61,27 @@ public bool DeployIndividualFiles
internal KuduConnectionInfo GetConnectionInfo()
{
- KuduConnectionInfo connectionInfo = new();
- connectionInfo.DestinationUrl = PublishUrl;
-
- connectionInfo.UserName = UserName;
- connectionInfo.Password = Password;
- connectionInfo.SiteName = PublishSiteName;
+ KuduConnectionInfo connectionInfo = new()
+ {
+ DestinationUrl = PublishUrl,
+ UserName = UserName,
+ Password = Password,
+ SiteName = PublishSiteName
+ };
return connectionInfo;
}
public override bool Execute()
{
- if (String.IsNullOrEmpty(PublishIntermediateOutputPath))
+ if (string.IsNullOrEmpty(PublishIntermediateOutputPath))
{
Log.LogError(Resources.KUDUDEPLOY_DeployOutputPathEmpty);
return false;
}
KuduConnectionInfo connectionInfo = GetConnectionInfo();
- if (String.IsNullOrEmpty(connectionInfo.UserName) || String.IsNullOrEmpty(connectionInfo.Password) || String.IsNullOrEmpty(connectionInfo.DestinationUrl))
+ if (string.IsNullOrEmpty(connectionInfo.UserName) || string.IsNullOrEmpty(connectionInfo.Password) || string.IsNullOrEmpty(connectionInfo.DestinationUrl))
{
Log.LogError(Resources.KUDUDEPLOY_ConnectionInfoMissing);
return false;
@@ -118,12 +119,12 @@ internal bool DeployFiles(KuduConnectionInfo connectionInfo)
success = deployTask.Wait(TimeoutMilliseconds);
if (!success)
{
- Log.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, Resources.KUDUDEPLOY_OperationTimeout));
+ Log.LogError(string.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, Resources.KUDUDEPLOY_OperationTimeout));
}
}
catch (AggregateException ae)
{
- Log.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, ae.Flatten().Message));
+ Log.LogError(string.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, ae.Flatten().Message));
success = false;
}
@@ -144,12 +145,12 @@ internal bool DeployZipFile(KuduConnectionInfo connectionInfo)
success = zipTask.Wait(TimeoutMilliseconds);
if (!success)
{
- Log.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, Resources.KUDUDEPLOY_OperationTimeout));
+ Log.LogError(string.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, Resources.KUDUDEPLOY_OperationTimeout));
}
}
catch (AggregateException ae)
{
- Log.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, ae.Flatten().Message));
+ Log.LogError(string.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, ae.Flatten().Message));
success = false;
}
@@ -162,8 +163,8 @@ internal bool DeployZipFile(KuduConnectionInfo connectionInfo)
internal string CreateZipFile(string sourcePath)
{
// Zip the files from PublishOutput path.
- string zipFileFullPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), String.Format("Publish{0}.zip", new Random().Next(Int32.MaxValue)));
- Log.LogMessage(Microsoft.Build.Framework.MessageImportance.High, String.Format(Resources.KUDUDEPLOY_CopyingToTempLocation, zipFileFullPath));
+ string zipFileFullPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), string.Format("Publish{0}.zip", new Random().Next(int.MaxValue)));
+ Log.LogMessage(Microsoft.Build.Framework.MessageImportance.High, string.Format(Resources.KUDUDEPLOY_CopyingToTempLocation, zipFileFullPath));
try
{
@@ -171,7 +172,7 @@ internal string CreateZipFile(string sourcePath)
}
catch (Exception e)
{
- Log.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, e.Message));
+ Log.LogError(string.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, e.Message));
// If we are unable to zip the file, then we fail.
return null;
}
diff --git a/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/GetPassword.cs b/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/GetPassword.cs
index 41fe0907f368..3d085cfd2505 100644
--- a/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/GetPassword.cs
+++ b/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/GetPassword.cs
@@ -33,7 +33,7 @@ public string GetClearTextPassword(string base64EncodedString)
return GetClearTextPassword(encryptedData);
}
- public static string GetClearTextPassword(Byte[] encryptedData)
+ public static string GetClearTextPassword(byte[] encryptedData)
{
if (encryptedData == null)
{
@@ -44,7 +44,7 @@ public static string GetClearTextPassword(Byte[] encryptedData)
try
{
#pragma warning disable CA1416 // This functionality is only expected to work in Windows.
- Byte[] uncrypted = System.Security.Cryptography.ProtectedData.Unprotect(encryptedData, null, System.Security.Cryptography.DataProtectionScope.CurrentUser);
+ byte[] uncrypted = System.Security.Cryptography.ProtectedData.Unprotect(encryptedData, null, System.Security.Cryptography.DataProtectionScope.CurrentUser);
#pragma warning restore CA1416 // This functionality is only expected to work in Windows.
plainPWD = Encoding.Unicode.GetString(uncrypted);
}
diff --git a/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/VsMsdeploy.cs b/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/VsMsdeploy.cs
index fd20dcc60091..a3b4914931fd 100644
--- a/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/VsMsdeploy.cs
+++ b/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/VsMsdeploy.cs
@@ -450,7 +450,7 @@ protected override void BeforeSync()
// Utility function to log all public instance property to CustomerBuildEventArgs
- private static void AddAllPropertiesToCustomBuildWithPropertyEventArgs(CustomBuildWithPropertiesEventArgs cbpEventArg, System.Object obj)
+ private static void AddAllPropertiesToCustomBuildWithPropertyEventArgs(CustomBuildWithPropertiesEventArgs cbpEventArg, object obj)
{
#if NET472
if (obj != null)
diff --git a/src/WebSdk/Publish/Tasks/Tasks/ValidateParameter.cs b/src/WebSdk/Publish/Tasks/Tasks/ValidateParameter.cs
index 3480155a1363..a6f21a24fbc0 100644
--- a/src/WebSdk/Publish/Tasks/Tasks/ValidateParameter.cs
+++ b/src/WebSdk/Publish/Tasks/Tasks/ValidateParameter.cs
@@ -16,9 +16,9 @@ public class ValidateParameter : Build.Utilities.Task
public override bool Execute()
{
- if (String.IsNullOrEmpty(ParameterValue))
+ if (string.IsNullOrEmpty(ParameterValue))
{
- Log.LogError(String.Format(CultureInfo.CurrentCulture, Resources.ValidateParameter_ArgumentNullError, ParameterName));
+ Log.LogError(string.Format(CultureInfo.CurrentCulture, Resources.ValidateParameter_ArgumentNullError, ParameterName));
return false;
}
diff --git a/src/WebSdk/Publish/Tasks/Tasks/Xdt/TaskTransformationLogger.cs b/src/WebSdk/Publish/Tasks/Tasks/Xdt/TaskTransformationLogger.cs
index 62521944797a..4235bbe9d080 100644
--- a/src/WebSdk/Publish/Tasks/Tasks/Xdt/TaskTransformationLogger.cs
+++ b/src/WebSdk/Publish/Tasks/Tasks/Xdt/TaskTransformationLogger.cs
@@ -37,7 +37,7 @@ private string IndentString
{
if (indentString == null)
{
- indentString = String.Empty;
+ indentString = string.Empty;
for (int i = 0; i < indentLevel; i++)
{
indentString += indentStringPiece;
@@ -86,7 +86,7 @@ void IXmlTransformationLogger.LogMessage(MessageType type, string message, param
break;
}
- loggingHelper.LogMessage(importance, String.Concat(IndentString, message), messageArgs);
+ loggingHelper.LogMessage(importance, string.Concat(IndentString, message), messageArgs);
}
void IXmlTransformationLogger.LogWarning(string message, params object[] messageArgs)
@@ -161,7 +161,7 @@ void IXmlTransformationLogger.LogErrorFromException(Exception ex, string file, i
{
sb.AppendFormat("{0} : {1}", exIterator.GetType().Name, exIterator.Message);
sb.AppendLine();
- if (!String.IsNullOrEmpty(exIterator.StackTrace))
+ if (!string.IsNullOrEmpty(exIterator.StackTrace))
{
sb.Append(exIterator.StackTrace);
}
diff --git a/src/WebSdk/Publish/Tasks/Tasks/Xdt/TransformXml.cs b/src/WebSdk/Publish/Tasks/Tasks/Xdt/TransformXml.cs
index d67f81d54cd2..8625993f7c2f 100644
--- a/src/WebSdk/Publish/Tasks/Tasks/Xdt/TransformXml.cs
+++ b/src/WebSdk/Publish/Tasks/Tasks/Xdt/TransformXml.cs
@@ -19,7 +19,7 @@ public class TransformXml : Task
private bool stackTrace = false;
[Required]
- public String Source
+ public string Source
{
get
{
@@ -42,7 +42,7 @@ public bool IgnoreError
[Required]
- public String Transform
+ public string Transform
{
get
{
@@ -72,7 +72,7 @@ public string TransformRootPath
[Required]
- public String Destination
+ public string Destination
{
get
{
@@ -202,9 +202,10 @@ private XmlTransformableDocument OpenSourceFile(string sourceFile)
{
try
{
- XmlTransformableDocument document = new();
-
- document.PreserveWhitespace = true;
+ XmlTransformableDocument document = new()
+ {
+ PreserveWhitespace = true
+ };
document.Load(sourceFile);
return document;
diff --git a/src/WebSdk/Publish/Tasks/WebConfigTransform.cs b/src/WebSdk/Publish/Tasks/WebConfigTransform.cs
index d5a583d59226..d23a99fd9234 100644
--- a/src/WebSdk/Publish/Tasks/WebConfigTransform.cs
+++ b/src/WebSdk/Publish/Tasks/WebConfigTransform.cs
@@ -117,7 +117,7 @@ private static void TransformAspNetCore(XElement aspNetCoreElement, string appNa
// if the app path is already there in the web.config, don't do anything.
if (string.Equals(appPath, (string)argumentsAttribute, StringComparison.OrdinalIgnoreCase))
{
- appPath = String.Empty;
+ appPath = string.Empty;
}
attributes.Insert(processPathIndex + 1,
new XAttribute("arguments", (appPath + " " + (string)argumentsAttribute).Trim()));