Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
c919723
Update dependencies from https://github.com/microsoft/testfx build 20…
dotnet-maestro[bot] Oct 23, 2025
670f0ab
[release/10.0.1xx] Update dependencies from microsoft/testfx (#51424)
SimonZhao888 Oct 23, 2025
0a9f0ea
Update dependencies from https://github.com/microsoft/testfx build 20…
dotnet-maestro[bot] Oct 24, 2025
58c8dc7
[release/10.0.1xx] Update dependencies from microsoft/testfx (#51439)
SimonZhao888 Oct 24, 2025
5dab158
Merge branch 'release/10.0.2xx' of https://github.com/dotnet/sdk into…
Oct 24, 2025
f99e889
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
SimonZhao888 Oct 24, 2025
d88624f
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
SimonZhao888 Oct 27, 2025
18545be
Merge branch 'release/10.0.2xx' of https://github.com/dotnet/sdk into…
Oct 27, 2025
30564ba
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
SimonZhao888 Oct 29, 2025
41a7f15
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
SimonZhao888 Oct 31, 2025
914c9da
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
SimonZhao888 Nov 3, 2025
601dac1
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
DonnaChen888 Nov 4, 2025
b43b2ec
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
DonnaChen888 Nov 4, 2025
05a73ef
Update dependencies from https://github.com/microsoft/testfx build 20…
dotnet-maestro[bot] Nov 5, 2025
0739b5a
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
DonnaChen888 Nov 5, 2025
03f6d6e
Merge branch 'release/10.0.2xx' into darc-release/10.0.2xx-97438f3c-b…
nagilson Nov 5, 2025
413d99b
Merge branch 'release/10.0.2xx' into darc-release/10.0.2xx-97438f3c-b…
DonnaChen888 Nov 6, 2025
450493b
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
DonnaChen888 Nov 6, 2025
5c8f7cb
Merge branch 'release/10.0.2xx' into darc-release/10.0.2xx-97438f3c-b…
DonnaChen888 Nov 6, 2025
1f0bf2f
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
DonnaChen888 Nov 6, 2025
cccffbb
Merge branch 'release/10.0.2xx' into darc-release/10.0.2xx-97438f3c-b…
nagilson Nov 7, 2025
9d94e51
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
DonnaChen888 Nov 7, 2025
00c5249
Backflow from https://github.com/dotnet/dotnet / 6f4c060 build 289866
dotnet-maestro[bot] Nov 7, 2025
5a6177c
Merge release/10.0.2xx into darc-release/10.0.2xx-64b0aa88-723e-4fdd-…
dotnet-maestro[bot] Nov 7, 2025
6029a62
Update dependencies from https://github.com/dotnet/dotnet build 289866
dotnet-maestro[bot] Nov 7, 2025
dcc8cfe
Delete duplicate tests
tmat Nov 7, 2025
11ededf
Update baseline
jjonescz Nov 7, 2025
6a04a91
Make GlobalPrefixRemover override VisitAliasQualifiedName instead of …
ericstj Oct 13, 2025
93ce3b4
Merge branch 'release/10.0.2xx' into darc-release/10.0.2xx-64b0aa88-7…
tmat Nov 7, 2025
82e2e7d
Update dependencies from https://github.com/microsoft/testfx build 20…
dotnet-maestro[bot] Nov 8, 2025
0cfbcaf
Update dependencies from https://github.com/microsoft/testfx build 20…
dotnet-maestro[bot] Nov 9, 2025
31f5075
Update dependencies from https://github.com/microsoft/testfx build 20…
dotnet-maestro[bot] Nov 10, 2025
9827b5f
Merge branch 'release/10.0.2xx' into darc-release/10.0.2xx-64b0aa88-7…
DonnaChen888 Nov 10, 2025
41f38b8
Merge branch 'release/10.0.2xx' into darc-release/10.0.2xx-97438f3c-b…
DonnaChen888 Nov 10, 2025
89617df
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
DonnaChen888 Nov 10, 2025
73af02e
Merge branch 'release/10.0.2xx' into darc-release/10.0.2xx-64b0aa88-7…
DonnaChen888 Nov 11, 2025
e5d688d
Merge branch 'release/10.0.2xx' into darc-release/10.0.2xx-97438f3c-b…
DonnaChen888 Nov 11, 2025
175506a
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
DonnaChen888 Nov 11, 2025
d91154f
Fix failing build task tests
jjonescz Nov 11, 2025
265a139
[release/10.0.2xx] Source code updates from dotnet/dotnet (#51612)
nagilson Nov 11, 2025
599261f
Suppress
Youssef1313 Nov 11, 2025
f0c7627
Suppress
Youssef1313 Nov 11, 2025
52f47bf
Suppress
Youssef1313 Nov 11, 2025
ec46acd
Suppress
Youssef1313 Nov 11, 2025
444d7d2
Merge branch 'release/10.0.2xx' into darc-release/10.0.2xx-97438f3c-b…
DonnaChen888 Nov 12, 2025
89662c8
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
DonnaChen888 Nov 12, 2025
4f0a377
Update dependencies from https://github.com/microsoft/testfx build 20…
dotnet-maestro[bot] Nov 12, 2025
ee432c9
[release/10.0.2xx] Update dependencies from microsoft/testfx (#51567)
DonnaChen888 Nov 12, 2025
db7b2f6
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
DonnaChen888 Nov 12, 2025
27674c0
Improve clarity of 'dotnet project convert' output directory prompt (…
Copilot Nov 12, 2025
f2d6e46
Refactor dotnet-watch into a package consumable from Aspire.CLI (#51223)
tmat Nov 12, 2025
c81e4d0
Update dependencies from https://github.com/microsoft/testfx build 20…
dotnet-maestro[bot] Nov 13, 2025
09c0dc7
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-releas…
DonnaChen888 Nov 13, 2025
cdcbd07
Remove more analyzer redirecting VSIX related stuff (#51692)
jjonescz Nov 13, 2025
ca4f27a
[release/10.0.2xx] Update dependencies from microsoft/testfx (#51709)
dsplaisted Nov 13, 2025
1af6f70
[automated] Merge branch 'release/10.0.1xx' => 'release/10.0.2xx' (#5…
dsplaisted Nov 13, 2025
b71399b
Merge 10.0.2xx to main
dsplaisted Nov 14, 2025
70488b0
Add version for Microsoft.CodeAnalysis.ExternalAccess.HotReload
dsplaisted Nov 14, 2025
ae38711
Update dependencies from dotnet/dotnet
dsplaisted Nov 17, 2025
3e2b37f
Update roslyn tests
jjonescz Nov 17, 2025
68cfd9e
Merge upstream changes
dsplaisted Nov 19, 2025
8d7c8c3
Merge upstream changes
dsplaisted Nov 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="$(MicrosoftCodeAnalysisPackageVersion)" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="$(MicrosoftCodeAnalysisPackageVersion)" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="$(MicrosoftCodeAnalysisWorkspacesMSBuildPackageVersion)" />
<PackageVersion Include="Microsoft.CodeAnalysis.ExternalAccess.HotReload" Version="$(MicrosoftCodeAnalysisExternalAccessHotReloadPackageVersion)" />

<!-- roslyn-sdk dependencies-->
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.2" />
Expand Down Expand Up @@ -81,8 +82,6 @@
<PackageVersion Include="Microsoft.TestPlatform.Build" Version="$(MicrosoftTestPlatformBuildPackageVersion)" />
<PackageVersion Include="Microsoft.TestPlatform.CLI" Version="$(MicrosoftTestPlatformCLIPackageVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Composition" Version="17.4.16" />
<PackageVersion Include="Microsoft.VisualStudio.Sdk" Version="17.2.32505.173" />
<PackageVersion Include="Microsoft.VSSDK.BuildTools" Version="17.11.435" />
<PackageVersion Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="$(MicrosoftVisualStudioSetupConfigurationInteropVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.SolutionPersistence" Version="$(MicrosoftVisualStudioSolutionPersistenceVersion)" />
<PackageVersion Include="Microsoft.Web.Deployment" Version="$(WebDeploymentPackageVersion)" />
Expand Down
2 changes: 0 additions & 2 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
<add key="dotnet-tools-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json" />
<add key="dotnet-libraries" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json" />
<add key="dotnet-libraries-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries-transport/nuget/v3/index.json" />
<add key="vssdk" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk/nuget/v3/index.json" />
<add key="vssdk-archived" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk-archived/nuget/v3/index.json" />
<add key="vs-impl" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json" />
<!-- Used for Rich Navigation indexing task -->
<add key="richnav" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-buildservices/nuget/v3/index.json" />
Expand Down
4 changes: 4 additions & 0 deletions eng/Publishing.props
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
<Artifact Remove="@(MsiPackages)" />
</ItemGroup>

<ItemGroup Condition="'$(PublishingWorkloadMsiInternal)' == 'true'">
<Artifact Update="$(ArtifactsShippingPackagesDir)*.Msi.*.nupkg" Visibility="Internal" />
</ItemGroup>

<Target Name="GetNonStableProductVersion">
<!-- Retrieve the non-stable product version. -->
<MSBuild Projects="$(RepoRoot)src\Layout\redist\redist.csproj"
Expand Down
4 changes: 1 addition & 3 deletions eng/Signing.props
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,8 @@
<FileSignInfo Include="Verify.dll" CertificateName="$(ExternalCertificateId)" />
<FileSignInfo Include="Verify.DiffPlex.dll" CertificateName="$(ExternalCertificateId)" />
</ItemGroup>

<ItemGroup>
<FileSignInfo Include="StreamJsonRpc.dll" CertificateName="MicrosoftSHA2" />

<ItemGroup>
<!-- Roslyn apphosts -->
<FileSignInfo Condition="'$(TargetOS)' == 'osx'" Include="csc;vbc;VBCSCompiler" CertificateName="MacDeveloperHarden" />
</ItemGroup>
Expand Down
232 changes: 117 additions & 115 deletions eng/Version.Details.props

Large diffs are not rendered by default.

458 changes: 231 additions & 227 deletions eng/Version.Details.xml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
compiler API targeted by analyzer assemblies. This is mostly an issue on source-build as
in that build mode analyzer assemblies always target the live compiler API. -->
<UsingToolMicrosoftNetCompilers Condition="'$(DotNetBuildSourceOnly)' == 'true'">true</UsingToolMicrosoftNetCompilers>
<UsingToolVSSDK>true</UsingToolVSSDK>
<FlagNetStandard1XDependencies Condition="'$(DotNetBuildSourceOnly)' == 'true'">true</FlagNetStandard1XDependencies>
</PropertyGroup>
<PropertyGroup Label="Servicing version information">
Expand Down
6 changes: 3 additions & 3 deletions eng/common/core-templates/steps/install-microbuild-impl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ parameters:
steps:
- ${{ if eq(parameters.enablePreviewMicrobuild, 'true') }}:
- task: MicroBuildSigningPluginPreview@4
displayName: Install Preview MicroBuild plugin (Windows)
displayName: Install Preview MicroBuild plugin
inputs: ${{ parameters.microbuildTaskInputs }}
env: ${{ parameters.microbuildEnv }}
continueOnError: ${{ parameters.continueOnError }}
condition: ${{ parameters.condition }}
- ${{ else }}:
- task: MicroBuildSigningPlugin@4
displayName: Install MicroBuild plugin (Windows)
displayName: Install MicroBuild plugin
inputs: ${{ parameters.microbuildTaskInputs }}
env: ${{ parameters.microbuildEnv }}
continueOnError: ${{ parameters.continueOnError }}
condition: ${{ parameters.condition }}
condition: ${{ parameters.condition }}
8 changes: 3 additions & 5 deletions eng/common/core-templates/steps/install-microbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@ parameters:
steps:
- ${{ if eq(parameters.enableMicrobuild, 'true') }}:
- ${{ if eq(parameters.enableMicrobuildForMacAndLinux, 'true') }}:
# Installing .NET 8 is required to use the MicroBuild signing plugin on non-Windows platforms
# Needed to download the MicroBuild plugin nupkgs on Mac and Linux when nuget.exe is unavailable
- task: UseDotNet@2
displayName: Install .NET 8.0 SDK for MicroBuild Plugin
inputs:
packageType: sdk
version: 8.0.x
# Installing the SDK in a '.dotnet-microbuild' directory is required for signing.
# See target FindDotNetPathForMicroBuild in arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj
# Do not remove '.dotnet-microbuild' from the path without changing the corresponding logic.
installationPath: $(Agent.TempDirectory)/.dotnet-microbuild
installationPath: ${{ parameters.microBuildOutputFolder }}/.dotnet
workingDirectory: ${{ parameters.microBuildOutputFolder }}
condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT'))

- script: |
Expand Down
4 changes: 3 additions & 1 deletion eng/common/core-templates/steps/publish-logs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ steps:
# If the file exists - sensitive data for redaction will be sourced from it
# (single entry per line, lines starting with '# ' are considered comments and skipped)
arguments: -InputPath '$(System.DefaultWorkingDirectory)/PostBuildLogs'
-BinlogToolVersion ${{parameters.BinlogToolVersion}}
-BinlogToolVersion '${{parameters.BinlogToolVersion}}'
-TokensFilePath '$(System.DefaultWorkingDirectory)/eng/BinlogSecretsRedactionFile.txt'
-runtimeSourceFeed https://ci.dot.net/internal
-runtimeSourceFeedKey '$(dotnetbuilds-internal-container-read-token-base64)'
'$(publishing-dnceng-devdiv-code-r-build-re)'
'$(MaestroAccessToken)'
'$(dn-bot-all-orgs-artifact-feeds-rw)'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ steps:
workingDirectory: $(Agent.TempDirectory)

- script: |
$(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version ${{parameters.sourceIndexProcessBinlogPackageVersion}} --add-source ${{parameters.SourceIndexPackageSource}} --tool-path $(Agent.TempDirectory)/.source-index/tools
$(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version ${{parameters.sourceIndexUploadPackageVersion}} --add-source ${{parameters.SourceIndexPackageSource}} --tool-path $(Agent.TempDirectory)/.source-index/tools
$(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version ${{parameters.sourceIndexProcessBinlogPackageVersion}} --source ${{parameters.SourceIndexPackageSource}} --tool-path $(Agent.TempDirectory)/.source-index/tools
$(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version ${{parameters.sourceIndexUploadPackageVersion}} --source ${{parameters.SourceIndexPackageSource}} --tool-path $(Agent.TempDirectory)/.source-index/tools
displayName: "Source Index: Download netsourceindex Tools"
# Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk.
workingDirectory: $(Agent.TempDirectory)
Expand Down
2 changes: 1 addition & 1 deletion eng/common/native/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ case "$os" in
libssl-dev libkrb5-dev pigz cpio

localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
elif [ "$ID" = "fedora" ] || [ "$ID" = "rhel" ] || [ "$ID" = "azurelinux" ]; then
elif [ "$ID" = "fedora" ] || [ "$ID" = "rhel" ] || [ "$ID" = "azurelinux" ] || [ "$ID" = "centos"]; then
pkg_mgr="$(command -v tdnf 2>/dev/null || command -v dnf)"
$pkg_mgr install -y cmake llvm lld lldb clang python curl libicu-devel openssl-devel krb5-devel lttng-ust-devel pigz cpio
elif [ "$ID" = "amzn" ]; then
Expand Down
4 changes: 3 additions & 1 deletion eng/common/post-build/redact-logs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ param(
# File with strings to redact - separated by newlines.
# For comments start the line with '# ' - such lines are ignored
[Parameter(Mandatory=$false)][string] $TokensFilePath,
[Parameter(ValueFromRemainingArguments=$true)][String[]]$TokensToRedact
[Parameter(ValueFromRemainingArguments=$true)][String[]]$TokensToRedact,
[Parameter(Mandatory=$false)][string] $runtimeSourceFeed,
[Parameter(Mandatory=$false)][string] $runtimeSourceFeedKey
)

try {
Expand Down
4 changes: 4 additions & 0 deletions sdk.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
<Project Path="src/BuiltInTools/HotReloadClient/Microsoft.DotNet.HotReload.Client.shproj" />
<Project Path="src/BuiltInTools/Web.Middleware/Microsoft.DotNet.HotReload.Web.Middleware.Package.csproj" />
<Project Path="src/BuiltInTools/Web.Middleware/Microsoft.DotNet.HotReload.Web.Middleware.shproj" />
<Project Path="src/BuiltInTools/Watch.Aspire/Microsoft.DotNet.HotReload.Watch.Aspire.csproj" />
<Project Path="src/BuiltInTools/Watch/Microsoft.DotNet.HotReload.Watch.csproj" />
</Folder>
<Folder Name="/src/Cli/">
<Project Path="src/Cli/dotnet/dotnet.csproj" />
Expand Down Expand Up @@ -325,6 +327,8 @@
<Project Path="test/Microsoft.AspNetCore.Watch.BrowserRefresh.Tests/Microsoft.AspNetCore.Watch.BrowserRefresh.Tests.csproj" />
<Project Path="test/Microsoft.DotNet.Cli.Utils.Tests/Microsoft.DotNet.Cli.Utils.Tests.csproj" />
<Project Path="test/Microsoft.DotNet.HotReload.Client.Tests/Microsoft.DotNet.HotReload.Client.Tests.csproj" />
<Project Path="test/Microsoft.DotNet.HotReload.Test.Utilities/Microsoft.DotNet.HotReload.Test.Utilities.csproj" />
<Project Path="test/Microsoft.DotNet.HotReload.Watch.Aspire.Tests/Microsoft.DotNet.HotReload.Watch.Aspire.Tests.csproj" />
<Project Path="test/Microsoft.DotNet.MSBuildSdkResolver.Tests/Microsoft.DotNet.MSBuildSdkResolver.Tests.csproj" />
<Project Path="test/Microsoft.DotNet.PackageInstall.Tests/Microsoft.DotNet.PackageInstall.Tests.csproj" />
<Project Path="test/Microsoft.DotNet.TemplateLocator.Tests/Microsoft.DotNet.TemplateLocator.Tests.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
-->
<TargetFrameworks>net6.0;net10.0</TargetFrameworks>
<StrongNameKeyId>MicrosoftAspNetCore</StrongNameKeyId>

<DisableTransitiveFrameworkReferenceDownloads Condition="'$(DotNetBuildSourceOnly)' == 'true'">true</DisableTransitiveFrameworkReferenceDownloads>
</PropertyGroup>

<!-- Reference 6.0.0 targeting packs in Source Build -->
Expand Down
84 changes: 84 additions & 0 deletions src/BuiltInTools/Watch.Aspire/DotNetWatchLauncher.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.Extensions.Logging;

namespace Microsoft.DotNet.Watch;

internal static class DotNetWatchLauncher
{
public static async Task<bool> RunAsync(string workingDirectory, DotNetWatchOptions options)
{
var globalOptions = new GlobalOptions()
{
Quiet = options.IsQuiet,
Verbose = options.IsVerbose,
NoHotReload = false,
NonInteractive = true,
};

var commandArguments = new List<string>();
if (options.NoLaunchProfile)
{
commandArguments.Add("--no-launch-profile");
}

commandArguments.AddRange(options.ApplicationArguments);

var rootProjectOptions = new ProjectOptions()
{
IsRootProject = true,
ProjectPath = options.ProjectPath,
WorkingDirectory = workingDirectory,
TargetFramework = null,
BuildArguments = [],
NoLaunchProfile = options.NoLaunchProfile,
LaunchProfileName = null,
Command = "run",
CommandArguments = [.. commandArguments],
LaunchEnvironmentVariables = [],
};

var muxerPath = Path.GetFullPath(Path.Combine(options.SdkDirectory, "..", "..", "dotnet" + PathUtilities.ExecutableExtension));

var console = new PhysicalConsole(TestFlags.None);
var reporter = new ConsoleReporter(console, globalOptions.Verbose, globalOptions.Quiet, suppressEmojis: false);
var environmentOptions = EnvironmentOptions.FromEnvironment(muxerPath);
var processRunner = new ProcessRunner(environmentOptions.GetProcessCleanupTimeout(isHotReloadEnabled: true));
var loggerFactory = new LoggerFactory(reporter);
var logger = loggerFactory.CreateLogger(DotNetWatchContext.DefaultLogComponentName);

using var context = new DotNetWatchContext()
{
ProcessOutputReporter = reporter,
LoggerFactory = loggerFactory,
Logger = logger,
BuildLogger = loggerFactory.CreateLogger(DotNetWatchContext.BuildLogComponentName),
ProcessRunner = processRunner,
Options = globalOptions,
EnvironmentOptions = environmentOptions,
RootProjectOptions = rootProjectOptions,
BrowserRefreshServerFactory = new BrowserRefreshServerFactory(),
BrowserLauncher = new BrowserLauncher(logger, reporter, environmentOptions),
};

using var shutdownHandler = new ShutdownHandler(console, logger);

try
{
var watcher = new HotReloadDotNetWatcher(context, console, runtimeProcessLauncherFactory: null);
await watcher.WatchAsync(shutdownHandler.CancellationToken);
}
catch (OperationCanceledException) when (shutdownHandler.CancellationToken.IsCancellationRequested)
{
// Ctrl+C forced an exit
}
catch (Exception e)
{
logger.LogError("An unexpected error occurred: {Exception}", e.ToString());
return false;
}

return true;
}
}
82 changes: 82 additions & 0 deletions src/BuiltInTools/Watch.Aspire/DotNetWatchOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Immutable;
using System.CommandLine;
using System.Diagnostics.CodeAnalysis;

namespace Microsoft.DotNet.Watch;

internal sealed class DotNetWatchOptions
{
/// <summary>
/// The .NET SDK directory to load msbuild from (e.g. C:\Program Files\dotnet\sdk\10.0.100).
/// Also used to locate `dotnet` executable.
/// </summary>
public required string SdkDirectory { get; init; }

public required string ProjectPath { get; init; }
public required ImmutableArray<string> ApplicationArguments { get; init; }
public bool IsVerbose { get; init; }
public bool IsQuiet { get; init; }
public bool NoLaunchProfile { get; init; }

public static bool TryParse(string[] args, [NotNullWhen(true)] out DotNetWatchOptions? options)
{
var sdkOption = new Option<string>("--sdk") { Arity = ArgumentArity.ExactlyOne, Required = true, AllowMultipleArgumentsPerToken = false };
var projectOption = new Option<string>("--project") { Arity = ArgumentArity.ExactlyOne, Required = true, AllowMultipleArgumentsPerToken = false };
var quietOption = new Option<bool>("--quiet") { Arity = ArgumentArity.Zero };
var verboseOption = new Option<bool>("--verbose") { Arity = ArgumentArity.Zero };
var noLaunchProfileOption = new Option<bool>("--no-launch-profile") { Arity = ArgumentArity.Zero };
var applicationArguments = new Argument<string[]>("arguments") { Arity = ArgumentArity.ZeroOrMore };

verboseOption.Validators.Add(v =>
{
if (v.GetValue(quietOption) && v.GetValue(verboseOption))
{
v.AddError("Cannot specify both '--quiet' and '--verbose' options.");
}
});

var rootCommand = new RootCommand()
{
Directives = { new EnvironmentVariablesDirective() },
Options =
{
sdkOption,
projectOption,
quietOption,
verboseOption,
noLaunchProfileOption
},
Arguments =
{
applicationArguments
}
};

var parseResult = rootCommand.Parse(args);
if (parseResult.Errors.Count > 0)
{
foreach (var error in parseResult.Errors)
{
Console.Error.WriteLine(error);
}

options = null;
return false;
}

options = new DotNetWatchOptions()
{
SdkDirectory = parseResult.GetRequiredValue(sdkOption),
ProjectPath = parseResult.GetRequiredValue(projectOption),
IsQuiet = parseResult.GetValue(quietOption),
IsVerbose = parseResult.GetValue(verboseOption),
ApplicationArguments = [.. parseResult.GetValue(applicationArguments) ?? []],
NoLaunchProfile = parseResult.GetValue(noLaunchProfileOption),
};

return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
<StrongNameKeyId>MicrosoftAspNetCore</StrongNameKeyId>
<OutputType>Exe</OutputType>
<RootNamespace>Microsoft.DotNet.Watch</RootNamespace>
<IsShipping>true</IsShipping>

<!-- NuGet -->
<IsPackable>true</IsPackable>
<IsShippingPackage>true</IsShippingPackage>
<PackAsTool>true</PackAsTool>
<PackageId>Microsoft.DotNet.HotReload.Watch.Aspire</PackageId>
<PackageDescription>
A supporting package for Aspire CLI:
https://github.com/dotnet/aspire
</PackageDescription>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.CommandLine" />
<PackageReference Include="Microsoft.Build.Locator" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Watch\Microsoft.DotNet.HotReload.Watch.csproj" />
</ItemGroup>

<ItemGroup>
<PublicAPI Include="PublicAPI.Shipped.txt" />
<PublicAPI Include="PublicAPI.Unshipped.txt" />
<PublicAPI Include="InternalAPI.Shipped.txt" />
<PublicAPI Include="InternalAPI.Unshipped.txt" />
</ItemGroup>

<Import Project="..\Watch\RuntimeDependencies.props" />
</Project>

12 changes: 12 additions & 0 deletions src/BuiltInTools/Watch.Aspire/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Microsoft.Build.Locator;
using Microsoft.DotNet.Watch;

if (!DotNetWatchOptions.TryParse(args, out var options))
{
return -1;
}

MSBuildLocator.RegisterMSBuildPath(options.SdkDirectory);

var workingDirectory = Directory.GetCurrentDirectory();
return await DotNetWatchLauncher.RunAsync(workingDirectory, options) ? 0 : 1;
Loading
Loading