Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
</PropertyGroup>
<PropertyGroup>
<!-- Dependency from https://github.com/dotnet/aspire -->
<AspirePackageVersion>9.4.0</AspirePackageVersion>
<AspirePackageVersion>13.1.2</AspirePackageVersion>
<MicrosoftExtensionsServiceDiscoveryPackageVersion>10.3.0</MicrosoftExtensionsServiceDiscoveryPackageVersion>
</PropertyGroup>
<PropertyGroup>
<!-- These are minimum versions used for netfx-targeted components that run in Visual Studio because in those cases,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\Watch\TargetFrameworks.props"/>

<PropertyGroup>
<!--
This assembly may be loaded .NET 6.0+ web server.
When updating the TFM also update minimal supported version in dotnet-watch.csproj and WebApplicationAppModel.cs.
When adding new TFM also update versions in dotnet-watch.csproj and WebApplicationAppModel.cs.
-->
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>$(MiddlewareTargetFrameworkV6)</TargetFramework>
<DisableTransitiveFrameworkReferenceDownloads Condition="'$(DotNetBuildSourceOnly)' == 'true'">true</DisableTransitiveFrameworkReferenceDownloads>

<StrongNameKeyId>MicrosoftAspNetCore</StrongNameKeyId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\Watch\TargetFrameworks.props"/>

<PropertyGroup>
<!--
dotnet-watch may inject this assembly to .NET 6.0+ app.

When updating these also update ProjectReferences in dotnet-watch.csproj
When adding new TFM also update ProjectReferences in dotnet-watch.csproj
and HotReloadAppModel.TryGetStartupHookPath.
-->
<TargetFrameworks>net6.0;net10.0</TargetFrameworks>
<TargetFrameworks>$(AgentTargetFrameworkV6);$(AgentTargetFrameworkV10)</TargetFrameworks>
<StrongNameKeyId>MicrosoftAspNetCore</StrongNameKeyId>

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

<!-- Reference 6.0.0 targeting packs in Source Build -->
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(TargetFramework)' == 'net6.0'">
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(TargetFramework)' == '$(AgentTargetFrameworkV6)'">
<FrameworkReference Update="Microsoft.NETCore.App" TargetingPackVersion="6.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\Watch\TargetFrameworks.props"/>

<PropertyGroup>
<!--
This code may be injected into a .NET 6.0+ app.

When updating these also update ProjectReferences in dotnet-watch.csproj
When adding new TFM also update ProjectReferences in dotnet-watch.csproj
and HotReloadAppModel.TryGetStartupHookPath.
-->
<TargetFrameworks>net6.0;net10.0</TargetFrameworks>
<TargetFrameworks>$(AgentTargetFrameworkV6);$(AgentTargetFrameworkV10)</TargetFrameworks>
<DisableTransitiveFrameworkReferenceDownloads Condition="'$(DotNetBuildSourceOnly)' == 'true'">true</DisableTransitiveFrameworkReferenceDownloads>

<GenerateDocumentationFile>false</GenerateDocumentationFile>
Expand All @@ -27,7 +28,7 @@
</PropertyGroup>

<!-- Reference 6.0.0 targeting packs in Source Build -->
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(TargetFramework)' == 'net6.0'">
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(TargetFramework)' == '$(AgentTargetFrameworkV6)'">
<FrameworkReference Update="Microsoft.NETCore.App" TargetingPackVersion="6.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\Watch\TargetFrameworks.props"/>

<PropertyGroup>
<!--
Intentionally pinned. This feature is supported in projects targeting 6.0 or newer.
-->
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>$(AgentTargetFrameworkV6)</TargetFramework>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<DebugType>none</DebugType>
<GenerateDependencyFile>false</GenerateDependencyFile>
Expand Down
12 changes: 7 additions & 5 deletions src/Dotnet.Watch/Watch/RuntimeDependencies.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)TargetFrameworks.props" />

<ItemGroup>
<ProjectReference Include="$(MSBuildThisFileDirectory)..\BrowserRefresh\Microsoft.AspNetCore.Watch.BrowserRefresh.csproj">
<OutputItemType>None</OutputItemType>
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<UndefineProperties>TargetFramework;TargetFrameworks</UndefineProperties>
<TargetPath>hotreload\net6.0\Microsoft.AspNetCore.Watch.BrowserRefresh.dll</TargetPath>
<TargetPath>hotreload\$(MiddlewareTargetFrameworkV6)\Microsoft.AspNetCore.Watch.BrowserRefresh.dll</TargetPath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

<!--
Expand All @@ -19,8 +21,8 @@
<OutputItemType>None</OutputItemType>
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<SetTargetFramework>TargetFramework=net10.0</SetTargetFramework>
<TargetPath>hotreload\net10.0\Microsoft.Extensions.DotNetDeltaApplier.dll</TargetPath>
<SetTargetFramework>TargetFramework=$(AgentTargetFrameworkV10)</SetTargetFramework>
<TargetPath>hotreload\$(AgentTargetFrameworkV10)\Microsoft.Extensions.DotNetDeltaApplier.dll</TargetPath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>false</Pack>
</ProjectReference>
Expand All @@ -29,8 +31,8 @@
<OutputItemType>None</OutputItemType>
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<SetTargetFramework>TargetFramework=net6.0</SetTargetFramework>
<TargetPath>hotreload\net6.0\Microsoft.Extensions.DotNetDeltaApplier.dll</TargetPath>
<SetTargetFramework>TargetFramework=$(AgentTargetFrameworkV6)</SetTargetFramework>
<TargetPath>hotreload\$(AgentTargetFrameworkV6)\Microsoft.Extensions.DotNetDeltaApplier.dll</TargetPath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Pack>false</Pack>
</ProjectReference>
Expand Down
15 changes: 15 additions & 0 deletions src/Dotnet.Watch/Watch/TargetFrameworks.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project>
<!--
!!! Intentionally fixed versions. Do not update to the latest. !!!
-->
<PropertyGroup>
<!-- Used for assemblies injected to apps targeting .NET 6.0 - .NET 9.0. -->
<AgentTargetFrameworkV6>net6.0</AgentTargetFrameworkV6>

<!-- Used for assemblies injected to apps targeting .NET 10.0+ -->
<AgentTargetFrameworkV10>net10.0</AgentTargetFrameworkV10>

<!-- Used for assemblies injected to web apps targeting .NET 6.0+ -->
<MiddlewareTargetFrameworkV6>net6.0</MiddlewareTargetFrameworkV6>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\Watch\TargetFrameworks.props"/>

<PropertyGroup>
<!--
This source code may be loaded by a .NET 6.0+ web server.
When updating the TFM also update minimal supported version in dotnet-watch.csproj and WebApplicationAppModel.cs.
-->
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>$(MiddlewareTargetFrameworkV6)</TargetFrameworks>
<DisableTransitiveFrameworkReferenceDownloads Condition="'$(DotNetBuildSourceOnly)' == 'true'">true</DisableTransitiveFrameworkReferenceDownloads>

<GenerateDocumentationFile>false</GenerateDocumentationFile>
Expand Down
3 changes: 2 additions & 1 deletion src/Dotnet.Watch/dotnet-watch/Watch/DotNetWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public static async Task WatchAsync(DotNetWatchContext context, CancellationToke
{
[EnvironmentVariables.Names.DotnetWatch] = "1",
[EnvironmentVariables.Names.DotnetWatchIteration] = (iteration + 1).ToString(CultureInfo.InvariantCulture),
}
},
OnOutput = line => context.ProcessOutputReporter.ReportOutput(line)
};

var browserRefreshServer = projectRootNode != null && HotReloadAppModel.InferFromProject(context, projectRootNode) is WebApplicationAppModel webAppModel
Expand Down
2 changes: 1 addition & 1 deletion test/ArgumentForwarding.Tests/ArgumentForwardingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ private string[] RawEvaluateArgumentString(string testUserArgument)
{
StartInfo = new ProcessStartInfo
{
FileName = TestContext.Current.ToolsetUnderTest.DotNetHostPath,
FileName = SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath,
Arguments = $"{ReflectorPath} {testUserArgument}",
UseShellExecute = false,
RedirectStandardOutput = true,
Expand Down
2 changes: 1 addition & 1 deletion test/Common/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private static int ShowSdkInfo()
{
var log = new StringTestLogger();
var command = new DotnetCommand(log, "--info");
var testDirectory = TestDirectory.Create(Path.Combine(TestContext.Current.TestExecutionDirectory, "sdkinfo"));
var testDirectory = TestDirectory.Create(Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "sdkinfo"));

command.WorkingDirectory = testDirectory.Path;

Expand Down
4 changes: 2 additions & 2 deletions test/EndToEnd.Tests/GivenDotNetUsesMSBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void ItCanRunToolsInACSProj()
project.Root.Add(itemGroup);
});

NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);

new RestoreCommand(testInstance)
.Execute()
Expand Down Expand Up @@ -93,7 +93,7 @@ public void ItCanRunToolsThatPrefersTheCliRuntimeEvenWhenTheToolItselfDeclaresAD
project.Root.Add(itemGroup);
});

NuGetConfigWriter.Write(testInstance.Path, TestContext.Current.TestPackages);
NuGetConfigWriter.Write(testInstance.Path, SdkTestContext.Current.TestPackages);

new RestoreCommand(testInstance)
.Execute()
Expand Down
4 changes: 2 additions & 2 deletions test/EndToEnd.Tests/ProjectBuildTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public void ItCanCreateAndBuildTemplatesWithDefaultFramework_DisableBuildOnLinux

private static string DetectExpectedDefaultFramework(string template = "")
{
string dotnetFolder = Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath);
string dotnetFolder = Path.GetDirectoryName(SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath);
string[] runtimeFolders = Directory.GetDirectories(Path.Combine(dotnetFolder, "shared", "Microsoft.NETCore.App"));
int latestMajorVersion = runtimeFolders.Select(folder => int.Parse(Path.GetFileName(folder).Split('.').First())).Max();
if (latestMajorVersion == 10)
Expand Down Expand Up @@ -468,7 +468,7 @@ XDocument GetProjectXml()
$"/bl:{templateName}-{(selfContained ? "selfcontained" : "fdd")}-{language}-{framework}-{{}}.binlog"
];

string dotnetRoot = Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath);
string dotnetRoot = Path.GetDirectoryName(SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath);
new DotnetBuildCommand(Log, projectDirectory)
.WithEnvironmentVariable("PATH", dotnetRoot) // override PATH since razor rely on PATH to find dotnet
.WithWorkingDirectory(projectDirectory)
Expand Down
2 changes: 1 addition & 1 deletion test/EndToEnd.Tests/ValidateInsertedManifests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ValidateInsertedManifests(ITestOutputHelper log) : SdkTest(log)
[Fact]
public void ManifestReaderCanReadManifests()
{
var sdkManifestDir = Path.Combine(Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath), "sdk-manifests");
var sdkManifestDir = Path.Combine(Path.GetDirectoryName(SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath), "sdk-manifests");
var sdkversionDir = new DirectoryInfo(sdkManifestDir).EnumerateDirectories().First();
foreach (var manifestVersionDir in sdkversionDir.EnumerateDirectories())
{
Expand Down
2 changes: 1 addition & 1 deletion test/EndToEnd.Tests/VersionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void DotnetVersionReturnsCorrectVersion()
var result = new DotnetCommand(Log).Execute("--version");
result.Should().Pass();

var dotnetFolder = Path.GetDirectoryName(TestContext.Current.ToolsetUnderTest.DotNetHostPath);
var dotnetFolder = Path.GetDirectoryName(SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath);
var sdkFolders = Directory.GetDirectories(Path.Combine(dotnetFolder, "sdk"));
sdkFolders.Length.Should().Be(1, "Only one SDK folder is expected in the layout");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal sealed class WatchableApp(
: IAsyncDisposable
{
public static WatchableApp CreateDotnetWatchApp(ITestOutputHelper logger)
=> new(logger, TestContext.Current.ToolsetUnderTest.DotNetHostPath, "watch", ["-bl"]);
=> new(logger, SdkTestContext.Current.ToolsetUnderTest.DotNetHostPath, "watch", ["-bl"]);

public DebugTestOutputLogger Logger { get; } = new DebugTestOutputLogger(logger);

Expand Down Expand Up @@ -204,6 +204,10 @@ public ProcessStartInfo GetProcessStartInfo(string workingDirectory, string test
info.Environment.Add("Microsoft_CodeAnalysis_EditAndContinue_LogDir", testOutputPath);
info.Environment.Add("DOTNET_CLI_CONTEXT_VERBOSE", "trace");

// Aspire DCP logging:
info.Environment.Add("DCP_DIAGNOSTICS_LOG_FOLDER", Path.Combine(testOutputPath, "dcp"));
info.Environment.Add("DCP_DIAGNOSTICS_LOG_LEVEL", "debug");

// suppress all timeouts:
info.Environment.Add("DCP_IDE_REQUEST_TIMEOUT_SECONDS", "100000");
info.Environment.Add("DCP_IDE_NOTIFICATION_TIMEOUT_SECONDS", "100000");
Expand All @@ -217,7 +221,7 @@ public ProcessStartInfo GetProcessStartInfo(string workingDirectory, string test
info.Environment[name] = value;
}

TestContext.Current.AddTestEnvironmentVariables(info.Environment);
SdkTestContext.Current.AddTestEnvironmentVariables(info.Environment);

return info;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ private WatchableApp CreateHostApp()
Logger,
executablePath: Path.ChangeExtension(typeof(AspireLauncher).Assembly.Location, PathUtilities.ExecutableExtension).TrimEnd('.'),
commandName: "host",
commandArguments: ["--sdk", TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest]);
commandArguments: ["--sdk", SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest]);

private WatchableApp CreateServerApp(string serverPipe)
=> new(
Logger,
executablePath: Path.ChangeExtension(typeof(AspireLauncher).Assembly.Location, PathUtilities.ExecutableExtension).TrimEnd('.'),
commandName: "server",
commandArguments: ["--sdk", TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "--server", serverPipe]);
commandArguments: ["--sdk", SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "--server", serverPipe]);

private WatchableApp CreateResourceApp(string serverPipe)
=> new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public string GetIdentifier() {

public string CreateTestTool(ITestOutputHelper log, TestToolSettings toolSettings, bool collectBinlogs = true)
{
var targetDirectory = Path.Combine(TestContext.Current.TestExecutionDirectory, "TestTools", toolSettings.GetIdentifier());
var targetDirectory = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, "TestTools", toolSettings.GetIdentifier());

var testProject = new TestProject(toolSettings.ToolPackageId)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal class DotnetEnvironmentTestFixture : IDisposable

public DotnetEnvironmentTestFixture()
{
string dotnetRootUnderTest = TestContext.Current.ToolsetUnderTest.DotNetRoot;
string dotnetRootUnderTest = SdkTestContext.Current.ToolsetUnderTest.DotNetRoot;
_originalPath = Environment.GetEnvironmentVariable(_PATH_VAR_NAME);
Environment.SetEnvironmentVariable(_PATH_VAR_NAME, dotnetRootUnderTest + Path.PathSeparator + _originalPath);
}
Expand Down Expand Up @@ -730,7 +730,7 @@ public void GivenARootWithNonAsciiCharacterInstallSucceeds()

WriteNugetConfigFile(fileSystem, nugetConfigPath, true);

var testRuntimeJsonPath = Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
var testRuntimeJsonPath = Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");

var downloader = new ToolPackageDownloader(
store: store,
Expand Down Expand Up @@ -899,7 +899,7 @@ private static void AssertInstallRollBack(IFileSystem fileSystem, IToolPackageSt
store = storeAndQuery;
storeQuery = storeAndQuery;
downloader = new ToolPackageDownloaderMock2(storeAndQuery,
runtimeJsonPathForTests: TestContext.GetRuntimeGraphFilePath(),
runtimeJsonPathForTests: SdkTestContext.GetRuntimeGraphFilePath(),
currentWorkingDirectory: root.Value,
fileSystem);

Expand All @@ -912,7 +912,7 @@ private static void AssertInstallRollBack(IFileSystem fileSystem, IToolPackageSt
var toolPackageStore = new ToolPackageStoreAndQuery(toolsRoot);
store = toolPackageStore;
storeQuery = toolPackageStore;
var testRuntimeJsonPath = Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
var testRuntimeJsonPath = Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
downloader = new ToolPackageDownloader(store, testRuntimeJsonPath, root.Value);
uninstaller = new ToolPackageUninstaller(store);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private static List<MockFeed> GetMockFeedsForConfigFile(FilePath nugetConfig)
{
fileSystem = new FileSystemWrapper();
store = new ToolPackageStoreAndQuery(root);
var runtimeJsonPathForTests = Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
var runtimeJsonPathForTests = Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
downloader = new ToolPackageDownloader(store, runtimeJsonPathForTests);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private static List<MockFeed> GetMockFeedsForSource(string source)
var toolPackageStore = new ToolPackageStoreAndQuery(root);
store = toolPackageStore;
storeQuery = toolPackageStore;
var testRuntimeJsonPath = Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
var testRuntimeJsonPath = Path.Combine(SdkTestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, "RuntimeIdentifierGraph.json");
downloader = new ToolPackageDownloader(store, testRuntimeJsonPath);
uninstaller = new ToolPackageUninstaller(store);
}
Expand Down
Loading