diff --git a/Directory.Build.props b/Directory.Build.props
index e74d10f1f541..e66d5cf571da 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -17,6 +17,8 @@
net6.0
+
+ $(SdkTargetFramework)
diff --git a/src/ApiCompat/Microsoft.DotNet.ApiCompat.Task/Microsoft.DotNet.ApiCompat.Task.csproj b/src/ApiCompat/Microsoft.DotNet.ApiCompat.Task/Microsoft.DotNet.ApiCompat.Task.csproj
index e56cd66fa1cd..c87b2758a261 100644
--- a/src/ApiCompat/Microsoft.DotNet.ApiCompat.Task/Microsoft.DotNet.ApiCompat.Task.csproj
+++ b/src/ApiCompat/Microsoft.DotNet.ApiCompat.Task/Microsoft.DotNet.ApiCompat.Task.csproj
@@ -2,6 +2,7 @@
net6.0;net472
+ net7.0;net472
true
true
Open
diff --git a/src/ApiCompat/Microsoft.DotNet.ApiCompat.Task/build/Microsoft.DotNet.ApiCompat.Task.targets b/src/ApiCompat/Microsoft.DotNet.ApiCompat.Task/build/Microsoft.DotNet.ApiCompat.Task.targets
index fb49a12fb4c4..cd2c97635880 100644
--- a/src/ApiCompat/Microsoft.DotNet.ApiCompat.Task/build/Microsoft.DotNet.ApiCompat.Task.targets
+++ b/src/ApiCompat/Microsoft.DotNet.ApiCompat.Task/build/Microsoft.DotNet.ApiCompat.Task.targets
@@ -2,7 +2,8 @@
$(MSBuildThisFileDirectory)..\tools\net472\Microsoft.DotNet.ApiCompat.Task.dll
- $(MSBuildThisFileDirectory)..\tools\net6.0\Microsoft.DotNet.ApiCompat.Task.dll
+ $(MSBuildThisFileDirectory)..\tools\net7.0\Microsoft.DotNet.ApiCompat.Task.dll
+ $(MSBuildThisFileDirectory)..\tools\net6.0\Microsoft.DotNet.ApiCompat.Task.dll
true
true
diff --git a/src/ApiCompat/Microsoft.DotNet.ApiCompat.Tool/Microsoft.DotNet.ApiCompat.Tool.csproj b/src/ApiCompat/Microsoft.DotNet.ApiCompat.Tool/Microsoft.DotNet.ApiCompat.Tool.csproj
index 4d148d136065..a9c9e3b472bf 100644
--- a/src/ApiCompat/Microsoft.DotNet.ApiCompat.Tool/Microsoft.DotNet.ApiCompat.Tool.csproj
+++ b/src/ApiCompat/Microsoft.DotNet.ApiCompat.Tool/Microsoft.DotNet.ApiCompat.Tool.csproj
@@ -2,6 +2,7 @@
net6.0
+ net7.0
Exe
enable
true
diff --git a/src/ApiCompat/Microsoft.DotNet.ApiCompatibility/Microsoft.DotNet.ApiCompatibility.csproj b/src/ApiCompat/Microsoft.DotNet.ApiCompatibility/Microsoft.DotNet.ApiCompatibility.csproj
index 4ee0173f242c..1e05a83e1977 100644
--- a/src/ApiCompat/Microsoft.DotNet.ApiCompatibility/Microsoft.DotNet.ApiCompatibility.csproj
+++ b/src/ApiCompat/Microsoft.DotNet.ApiCompatibility/Microsoft.DotNet.ApiCompatibility.csproj
@@ -2,6 +2,7 @@
net6.0;net472
+ net7.0;net472
Open
enable
diff --git a/src/ApiCompat/Microsoft.DotNet.PackageValidation/Microsoft.DotNet.PackageValidation.csproj b/src/ApiCompat/Microsoft.DotNet.PackageValidation/Microsoft.DotNet.PackageValidation.csproj
index aa6de655f57d..0c91c02884f5 100644
--- a/src/ApiCompat/Microsoft.DotNet.PackageValidation/Microsoft.DotNet.PackageValidation.csproj
+++ b/src/ApiCompat/Microsoft.DotNet.PackageValidation/Microsoft.DotNet.PackageValidation.csproj
@@ -2,6 +2,7 @@
net6.0;net472
+ net7.0;net472
Open
enable
diff --git a/src/Assets/TestProjects/WatchAppWithLaunchSettings/WatchAppWithLaunchSettings.csproj b/src/Assets/TestProjects/WatchAppWithLaunchSettings/WatchAppWithLaunchSettings.csproj
index 74abf5c97664..f02677bf640f 100644
--- a/src/Assets/TestProjects/WatchAppWithLaunchSettings/WatchAppWithLaunchSettings.csproj
+++ b/src/Assets/TestProjects/WatchAppWithLaunchSettings/WatchAppWithLaunchSettings.csproj
@@ -2,7 +2,7 @@
Exe
- net6.0
+ net7.0
enable
enable
diff --git a/src/BuiltInTools/DotNetDeltaApplier/Microsoft.Extensions.DotNetDeltaApplier.csproj b/src/BuiltInTools/DotNetDeltaApplier/Microsoft.Extensions.DotNetDeltaApplier.csproj
index 40927ae1f263..3c2236e38d14 100644
--- a/src/BuiltInTools/DotNetDeltaApplier/Microsoft.Extensions.DotNetDeltaApplier.csproj
+++ b/src/BuiltInTools/DotNetDeltaApplier/Microsoft.Extensions.DotNetDeltaApplier.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net7.0
MicrosoftAspNetCore
false
diff --git a/src/Layout/redist/targets/GenerateLayout.targets b/src/Layout/redist/targets/GenerateLayout.targets
index 148464df9e8e..d399fe6f2985 100644
--- a/src/Layout/redist/targets/GenerateLayout.targets
+++ b/src/Layout/redist/targets/GenerateLayout.targets
@@ -196,7 +196,7 @@
-
+
diff --git a/src/Layout/redist/targets/OverlaySdkOnLKG.targets b/src/Layout/redist/targets/OverlaySdkOnLKG.targets
index b31188d592de..4052c1581b1a 100644
--- a/src/Layout/redist/targets/OverlaySdkOnLKG.targets
+++ b/src/Layout/redist/targets/OverlaySdkOnLKG.targets
@@ -77,7 +77,7 @@
-
+
diff --git a/src/Resolvers/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj b/src/Resolvers/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj
index fddcbefd6f49..4a1830bd19d6 100644
--- a/src/Resolvers/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj
+++ b/src/Resolvers/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj
@@ -1,8 +1,8 @@
- net6.0;net472
- net6.0
+ $(ResolverTargetFramework);net472
+ $(ResolverTargetFramework)
AnyCPU
win-x86;win-x64
true
diff --git a/src/Tests/dotnet-watch.Tests/BrowserLaunchTests.cs b/src/Tests/dotnet-watch.Tests/BrowserLaunchTests.cs
index f479dcf9dd88..b74bb546a0bb 100644
--- a/src/Tests/dotnet-watch.Tests/BrowserLaunchTests.cs
+++ b/src/Tests/dotnet-watch.Tests/BrowserLaunchTests.cs
@@ -37,7 +37,7 @@ public async Task LaunchesBrowserOnStart()
await app.StartWatcherAsync();
// Verify we launched the browser.
- await app.Process.GetOutputLineStartsWithAsync(expected, TimeSpan.FromMinutes(2));
+ await app.Process.GetOutputLineStartsWithAsync(expected);
}
[Fact]
@@ -57,7 +57,7 @@ public async Task UsesBrowserSpecifiedInEnvironment()
await app.StartWatcherAsync();
// Verify we launched the browser.
- await app.Process.GetOutputLineStartsWithAsync(launchBrowserMessage, TimeSpan.FromMinutes(2));
+ await app.Process.GetOutputLineStartsWithAsync(launchBrowserMessage);
}
}
}
diff --git a/src/Tests/dotnet-watch.Tests/DotNetWatcherTests.cs b/src/Tests/dotnet-watch.Tests/DotNetWatcherTests.cs
index 2efd634a4157..b1e492402114 100644
--- a/src/Tests/dotnet-watch.Tests/DotNetWatcherTests.cs
+++ b/src/Tests/dotnet-watch.Tests/DotNetWatcherTests.cs
@@ -36,7 +36,7 @@ public async Task RunsWithDotnetWatchEnvVariable()
await app.StartWatcherAsync();
const string messagePrefix = "DOTNET_WATCH = ";
- var message = await app.Process.GetOutputLineStartsWithAsync(messagePrefix, TimeSpan.FromMinutes(2));
+ var message = await app.Process.GetOutputLineStartsWithAsync(messagePrefix);
var envValue = message.Substring(messagePrefix.Length);
Assert.Equal("1", envValue);
}
@@ -55,16 +55,16 @@ public async Task RunsWithIterationEnvVariable()
var contents = File.ReadAllText(source);
const string messagePrefix = "DOTNET_WATCH_ITERATION = ";
- var message = await app.Process.GetOutputLineStartsWithAsync(messagePrefix, TimeSpan.FromMinutes(2));
+ var message = await app.Process.GetOutputLineStartsWithAsync(messagePrefix);
var count = int.Parse(message.Substring(messagePrefix.Length), CultureInfo.InvariantCulture);
Assert.Equal(1, count);
await app.IsWaitingForFileChange();
File.SetLastWriteTime(source, DateTime.Now);
- await app.HasRestarted(TimeSpan.FromMinutes(1));
+ await app.HasRestarted();
- message = await app.Process.GetOutputLineStartsWithAsync(messagePrefix, TimeSpan.FromMinutes(2));
+ message = await app.Process.GetOutputLineStartsWithAsync(messagePrefix);
count = int.Parse(message.Substring(messagePrefix.Length), CultureInfo.InvariantCulture);
Assert.Equal(2, count);
}
@@ -90,7 +90,7 @@ public async Task RunsWithNoRestoreOnOrdinaryFileChanges()
for (var i = 0; i < 3; i++)
{
File.SetLastWriteTime(source, DateTime.Now);
- var message = await app.Process.GetOutputLineStartsWithAsync(messagePrefix, TimeSpan.FromMinutes(2));
+ var message = await app.Process.GetOutputLineStartsWithAsync(messagePrefix);
Assert.Equal(messagePrefix + " --no-restore -- wait", message.Trim());
@@ -117,7 +117,7 @@ public async Task RunsWithRestoreIfCsprojChanges()
Assert.Contains(app.Process.Output, p => string.Equals(messagePrefix + " -- wait", p.Trim()));
File.SetLastWriteTime(source, DateTime.Now);
- var message = await app.Process.GetOutputLineStartsWithAsync(messagePrefix, TimeSpan.FromMinutes(2));
+ var message = await app.Process.GetOutputLineStartsWithAsync(messagePrefix);
// csproj changed. Do not expect a --no-restore
Assert.Equal(messagePrefix + " -- wait", message.Trim());
@@ -126,7 +126,7 @@ public async Task RunsWithRestoreIfCsprojChanges()
// regular file changed after csproj changes. Should use --no-restore
File.SetLastWriteTime(Path.Combine(app.SourceDirectory, "Program.cs"), DateTime.Now);
- message = await app.Process.GetOutputLineStartsWithAsync(messagePrefix, TimeSpan.FromMinutes(2));
+ message = await app.Process.GetOutputLineStartsWithAsync(messagePrefix);
Assert.Equal(messagePrefix + " --no-restore -- wait", message.Trim());
}
@@ -143,7 +143,7 @@ public async Task Run_WithHotReloadEnabled_ReadsLaunchSettings()
await app.StartWatcherAsync();
- await app.Process.GetOutputLineAsyncWithConsoleHistoryAsync("Environment: Development", TimeSpan.FromSeconds(10));
+ await app.Process.GetOutputLineAsyncWithConsoleHistoryAsync("Environment: Development");
}
[Fact(Skip = "https://github.com/dotnet/sdk/issues/24406")]
@@ -166,7 +166,7 @@ public async Task Run_WithHotReloadEnabled_ReadsLaunchSettings_WhenUsingProjectO
await app.StartWatcherAsync();
- await app.Process.GetOutputLineAsyncWithConsoleHistoryAsync("Environment: Development", TimeSpan.FromSeconds(10));
+ await app.Process.GetOutputLineAsyncWithConsoleHistoryAsync("Environment: Development");
}
[CoreMSBuildOnlyFact]
@@ -192,8 +192,8 @@ public async Task Run_WithHotReloadEnabled_DoesNotReadConsoleIn_InNonInteractive
var standardInput = app.Process.Process.StandardInput;
var inputString = "This is a test input";
- await standardInput.WriteLineAsync(inputString).WaitAsync(TimeSpan.FromSeconds(10));
- await app.Process.GetOutputLineAsync($"Echo: {inputString}", TimeSpan.FromSeconds(10));
+ await standardInput.WriteLineAsync(inputString);
+ await app.Process.GetOutputLineAsync($"Echo: {inputString}");
}
}
}
diff --git a/src/Tests/dotnet-watch.Tests/GlobbingAppTests.cs b/src/Tests/dotnet-watch.Tests/GlobbingAppTests.cs
index d6cbafa2db79..27027c8b98cb 100644
--- a/src/Tests/dotnet-watch.Tests/GlobbingAppTests.cs
+++ b/src/Tests/dotnet-watch.Tests/GlobbingAppTests.cs
@@ -16,7 +16,6 @@ namespace Microsoft.DotNet.Watcher.Tools
public class GlobbingAppTests
{
private const string AppName = "WatchGlobbingApp";
- private static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(60);
private readonly TestAssetsManager _testAssetsManager;
private readonly ITestOutputHelper _logger;
@@ -38,18 +37,18 @@ public async Task ChangeCompiledFile(bool usePollingWatcher)
using var app = new WatchableApp(testAsset, _logger);
app.UsePollingWatcher = usePollingWatcher;
- await app.StartWatcherAsync().TimeoutAfter(DefaultTimeout);
+ await app.StartWatcherAsync();
- var types = await GetCompiledAppDefinedTypes(app).TimeoutAfter(DefaultTimeout);
+ var types = await GetCompiledAppDefinedTypes(app);
Assert.Equal(2, types);
var fileToChange = Path.Combine(app.SourceDirectory, "include", "Foo.cs");
var programCs = File.ReadAllText(fileToChange);
File.WriteAllText(fileToChange, programCs);
- await app.HasFileChanged().TimeoutAfter(DefaultTimeout);
- await app.HasRestarted().TimeoutAfter(DefaultTimeout);
- types = await GetCompiledAppDefinedTypes(app).TimeoutAfter(DefaultTimeout);
+ await app.HasFileChanged();
+ await app.HasRestarted();
+ types = await GetCompiledAppDefinedTypes(app);
Assert.Equal(2, types);
}
@@ -62,16 +61,16 @@ public async Task DeleteCompiledFile()
using var app = new WatchableApp(testAsset, _logger);
- await app.StartWatcherAsync().TimeoutAfter(DefaultTimeout);
+ await app.StartWatcherAsync();
- var types = await GetCompiledAppDefinedTypes(app).TimeoutAfter(DefaultTimeout);
+ var types = await GetCompiledAppDefinedTypes(app);
Assert.Equal(2, types);
var fileToChange = Path.Combine(app.SourceDirectory, "include", "Foo.cs");
File.Delete(fileToChange);
- await app.HasRestarted().TimeoutAfter(DefaultTimeout);
- types = await GetCompiledAppDefinedTypes(app).TimeoutAfter(DefaultTimeout);
+ await app.HasRestarted();
+ types = await GetCompiledAppDefinedTypes(app);
Assert.Equal(1, types);
}
@@ -84,16 +83,16 @@ public async Task DeleteSourceFolder()
using var app = new WatchableApp(testAsset, _logger);
- await app.StartWatcherAsync().TimeoutAfter(DefaultTimeout);
+ await app.StartWatcherAsync();
- var types = await GetCompiledAppDefinedTypes(app).TimeoutAfter(DefaultTimeout);
+ var types = await GetCompiledAppDefinedTypes(app);
Assert.Equal(2, types);
var folderToDelete = Path.Combine(app.SourceDirectory, "include");
Directory.Delete(folderToDelete, recursive: true);
- await app.HasRestarted().TimeoutAfter(DefaultTimeout);
- types = await GetCompiledAppDefinedTypes(app).TimeoutAfter(DefaultTimeout);
+ await app.HasRestarted();
+ types = await GetCompiledAppDefinedTypes(app);
Assert.Equal(1, types);
}
@@ -106,13 +105,13 @@ public async Task RenameCompiledFile()
using var app = new WatchableApp(testAsset, _logger);
- await app.StartWatcherAsync().TimeoutAfter(DefaultTimeout);
+ await app.StartWatcherAsync();
var oldFile = Path.Combine(app.SourceDirectory, "include", "Foo.cs");
var newFile = Path.Combine(app.SourceDirectory, "include", "Foo_new.cs");
File.Move(oldFile, newFile);
- await app.HasRestarted().TimeoutAfter(DefaultTimeout);
+ await app.HasRestarted();
}
[Fact]
@@ -124,7 +123,7 @@ public async Task ChangeExcludedFile()
using var app = new WatchableApp(testAsset, _logger);
- await app.StartWatcherAsync().TimeoutAfter(DefaultTimeout);
+ await app.StartWatcherAsync();
var changedFile = Path.Combine(app.SourceDirectory, "exclude", "Baz.cs");
File.WriteAllText(changedFile, "");
@@ -147,7 +146,7 @@ public async Task ListsFiles()
app.Start(new[] { "--list" });
var cts = new CancellationTokenSource();
cts.CancelAfter(TimeSpan.FromSeconds(30));
- var lines = await app.Process.GetAllOutputLinesAsync(cts.Token).TimeoutAfter(DefaultTimeout);
+ var lines = await app.Process.GetAllOutputLinesAsync(cts.Token);
var files = lines.Where(l => !l.StartsWith("watch :"));
AssertEx.EqualFileList(
@@ -163,7 +162,7 @@ public async Task ListsFiles()
private async Task GetCompiledAppDefinedTypes(WatchableApp app)
{
- var definedTypesMessage = await app.Process.GetOutputLineStartsWithAsync("Defined types = ", TimeSpan.FromSeconds(30));
+ var definedTypesMessage = await app.Process.GetOutputLineStartsWithAsync("Defined types = ");
return int.Parse(definedTypesMessage.Split('=').Last());
}
}
diff --git a/src/Tests/dotnet-watch.Tests/Utilities/AwaitableProcess.cs b/src/Tests/dotnet-watch.Tests/Utilities/AwaitableProcess.cs
index 25282f20916a..dfe789cca537 100644
--- a/src/Tests/dotnet-watch.Tests/Utilities/AwaitableProcess.cs
+++ b/src/Tests/dotnet-watch.Tests/Utilities/AwaitableProcess.cs
@@ -75,7 +75,7 @@ public void Start()
WriteTestOutput($"{DateTime.Now}: process started: '{_process.StartInfo.FileName} {_process.StartInfo.Arguments}'");
}
- public Task GetOutputLineAsyncWithConsoleHistoryAsync(string message, TimeSpan timeout)
+ public Task GetOutputLineAsyncWithConsoleHistoryAsync(string message)
{
if (_lines.Contains(message))
{
@@ -84,23 +84,19 @@ public Task GetOutputLineAsyncWithConsoleHistoryAsync(string message, Ti
}
WriteTestOutput($"Did not find [msg == '{message}'] in console history.");
- return GetOutputLineAsync(message, timeout);
+ return GetOutputLineAsync(message);
}
- public async Task GetOutputLineAsync(string message, TimeSpan timeout)
+ public async Task GetOutputLineAsync(string message)
{
- WriteTestOutput($"Waiting for output line [msg == '{message}']. Will wait for {timeout.TotalSeconds} sec.");
- var cts = new CancellationTokenSource();
- cts.CancelAfter(timeout);
- return await GetOutputLineAsync($"[msg == '{message}']", m => string.Equals(m, message, StringComparison.Ordinal), cts.Token);
+ WriteTestOutput($"Waiting for output line [msg == '{message}']");
+ return await GetOutputLineAsync($"[msg == '{message}']", m => string.Equals(m, message, StringComparison.Ordinal), CancellationToken.None);
}
- public async Task GetOutputLineStartsWithAsync(string message, TimeSpan timeout)
+ public async Task GetOutputLineStartsWithAsync(string message)
{
- WriteTestOutput($"Waiting for output line [msg.StartsWith('{message}')]. Will wait for {timeout.TotalSeconds} sec.");
- var cts = new CancellationTokenSource();
- cts.CancelAfter(timeout);
- return await GetOutputLineAsync($"[msg.StartsWith('{message}')]", m => m != null && m.StartsWith(message, StringComparison.Ordinal), cts.Token);
+ WriteTestOutput($"Waiting for output line [msg.StartsWith('{message}')].");
+ return await GetOutputLineAsync($"[msg.StartsWith('{message}')]", m => m != null && m.StartsWith(message, StringComparison.Ordinal), CancellationToken.None);
}
private async Task GetOutputLineAsync(string predicateName, Predicate predicate, CancellationToken cancellationToken)
diff --git a/src/Tests/dotnet-watch.Tests/Utilities/WatchableApp.cs b/src/Tests/dotnet-watch.Tests/Utilities/WatchableApp.cs
index 9a3dc306bdd8..b8e3ec7a2229 100644
--- a/src/Tests/dotnet-watch.Tests/Utilities/WatchableApp.cs
+++ b/src/Tests/dotnet-watch.Tests/Utilities/WatchableApp.cs
@@ -15,8 +15,6 @@ namespace Microsoft.DotNet.Watcher.Tools
{
internal sealed class WatchableApp : IDisposable
{
- private static readonly TimeSpan DefaultMessageTimeOut = TimeSpan.FromSeconds(30);
-
private const string StartedMessage = "Started";
private const string ExitingMessage = "Exiting";
private const string WatchStartedMessage = "dotnet watch 🚀 Started";
@@ -44,25 +42,22 @@ public WatchableApp(string sourceDirectory, ITestOutputHelper logger)
public string WorkingDirectory { get; set; }
public Task HasRestarted()
- => HasRestarted(DefaultMessageTimeOut);
-
- public Task HasRestarted(TimeSpan timeout)
- => Process.GetOutputLineAsync(StartedMessage, timeout);
+ => Process.GetOutputLineAsync(StartedMessage);
public async Task HasExited()
{
- await Process.GetOutputLineAsync(ExitingMessage, DefaultMessageTimeOut);
- await Process.GetOutputLineStartsWithAsync(WatchExitedMessage, DefaultMessageTimeOut);
+ await Process.GetOutputLineAsync(ExitingMessage);
+ await Process.GetOutputLineStartsWithAsync(WatchExitedMessage);
}
public Task IsWaitingForFileChange()
{
- return Process.GetOutputLineStartsWithAsync(WaitingForFileChangeMessage, DefaultMessageTimeOut);
+ return Process.GetOutputLineStartsWithAsync(WaitingForFileChangeMessage);
}
public Task HasFileChanged()
{
- return Process.GetOutputLineStartsWithAsync(WatchFileChanged, DefaultMessageTimeOut);
+ return Process.GetOutputLineStartsWithAsync(WatchFileChanged);
}
public bool UsePollingWatcher { get; set; }
@@ -71,7 +66,7 @@ public async Task GetProcessIdentifier()
{
// Process ID is insufficient because PID's may be reused. Process identifier also includes other info to distinguish
// between different process instances.
- var line = await Process.GetOutputLineStartsWithAsync("Process identifier =", DefaultMessageTimeOut);
+ var line = await Process.GetOutputLineStartsWithAsync("Process identifier =");
return line.Split('=').Last();
}
@@ -125,7 +120,7 @@ public async Task StartWatcherAsync(string[] arguments, [CallerMemberName] strin
// Make this timeout long because it depends much on the MSBuild compilation speed.
// Slow machines may take a bit to compile and boot test apps
- await Process.GetOutputLineAsync(WatchStartedMessage, TimeSpan.FromMinutes(2));
+ await Process.GetOutputLineAsync(WatchStartedMessage);
}
public void Dispose()