Skip to content

Commit 17b0edc

Browse files
Make "current" target framework the default
Seeing if this fixes macOS arm64
1 parent 94ef0e9 commit 17b0edc

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

test/TestAssets/TestProjects/DotnetRunDevices/DotnetRunDevices.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
<Devices Include="single-device" Description="Single Device" Type="Emulator" Status="Online" RuntimeIdentifier="$(NETCoreSdkRuntimeIdentifier)" />
1212
</ItemGroup>
1313
<!-- Otherwise return multiple devices based on target framework -->
14-
<ItemGroup Condition="'$(NoDevices)' != 'true' and '$(SingleDevice)' != 'true' and '$(TargetFramework)' == 'net9.0'">
14+
<ItemGroup Condition="'$(NoDevices)' != 'true' and '$(SingleDevice)' != 'true' and '$(TargetFramework)' != 'net9.0'">
1515
<Devices Include="test-device-1" Description="Test Device 1" Type="Emulator" Status="Online" RuntimeIdentifier="$(NETCoreSdkRuntimeIdentifier)" />
1616
<Devices Include="test-device-2" Description="Test Device 2" Type="Device" Status="Online" />
1717
</ItemGroup>
18-
<ItemGroup Condition="'$(NoDevices)' != 'true' and '$(SingleDevice)' != 'true' and '$(TargetFramework)' != 'net9.0'">
19-
<Devices Include="test-device-current-1" Description="Test Device Current 1" Type="Emulator" Status="Online" RuntimeIdentifier="$(NETCoreSdkRuntimeIdentifier)" />
20-
<Devices Include="test-device-current-2" Description="Test Device Current 2" Type="Simulator" Status="Booted" />
18+
<ItemGroup Condition="'$(NoDevices)' != 'true' and '$(SingleDevice)' != 'true' and '$(TargetFramework)' == 'net9.0'">
19+
<Devices Include="test-device-downlevel-1" Description="Test Device Downlevel 1" Type="Emulator" Status="Online" RuntimeIdentifier="$(NETCoreSdkRuntimeIdentifier)" />
20+
<Devices Include="test-device-downlevel-2" Description="Test Device Downlevel 2" Type="Simulator" Status="Booted" />
2121
</ItemGroup>
2222
</Target>
2323

test/dotnet.Tests/CommandTests/Run/GivenDotnetRunSelectsDevice.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void ItFailsInNonInteractiveMode_WhenMultipleDevicesAvailableAndNoneSpeci
2525
var result = new DotnetCommand(Log, "run")
2626
.WithWorkingDirectory(testInstance.Path)
2727
.WithEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
28-
.Execute("--framework", "net9.0", "--no-interactive");
28+
.Execute("--framework", ToolsetInfo.CurrentTargetFramework, "--no-interactive");
2929

3030
result.Should().Fail()
3131
.And.HaveStdErrContaining(string.Format(CliCommandStrings.RunCommandExceptionUnableToRunSpecifyDevice, "--device"));
@@ -39,7 +39,7 @@ public void ItListsDevicesForSpecifiedFramework()
3939

4040
var result = new DotnetCommand(Log, "run")
4141
.WithWorkingDirectory(testInstance.Path)
42-
.Execute("--framework", "net9.0", "--list-devices");
42+
.Execute("--framework", ToolsetInfo.CurrentTargetFramework, "--list-devices");
4343

4444
result.Should().Pass()
4545
.And.HaveStdOutContaining("test-device-1")
@@ -48,16 +48,16 @@ public void ItListsDevicesForSpecifiedFramework()
4848
}
4949

5050
[Theory]
51-
[InlineData("net9.0", "test-device-1")]
52-
[InlineData("net9.0", "test-device-2")]
53-
public void ItRunsDifferentDevicesInMultiTargetedApp(string targetFramework, string deviceId)
51+
[InlineData("test-device-1")]
52+
[InlineData("test-device-2")]
53+
public void ItRunsDifferentDevicesInMultiTargetedApp(string deviceId)
5454
{
5555
var testInstance = _testAssetsManager.CopyTestAsset("DotnetRunDevices")
5656
.WithSource();
5757

5858
new DotnetCommand(Log, "run")
5959
.WithWorkingDirectory(testInstance.Path)
60-
.Execute("--framework", targetFramework, "--device", deviceId)
60+
.Execute("--framework", ToolsetInfo.CurrentTargetFramework, "--device", deviceId)
6161
.Should().Pass()
6262
.And.HaveStdOutContaining($"Device: {deviceId}");
6363
}
@@ -71,7 +71,7 @@ public void ItShowsErrorMessageWithAvailableDevices_InNonInteractiveMode()
7171
var result = new DotnetCommand(Log, "run")
7272
.WithWorkingDirectory(testInstance.Path)
7373
.WithEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
74-
.Execute("--framework", "net9.0", "--no-interactive");
74+
.Execute("--framework", ToolsetInfo.CurrentTargetFramework, "--no-interactive");
7575

7676
result.Should().Fail()
7777
.And.HaveStdErrContaining(string.Format(CliCommandStrings.RunCommandExceptionUnableToRunSpecifyDevice, "--device"))
@@ -106,7 +106,7 @@ public void ItTreatsEmptyDeviceSpecificationAsNotSpecified()
106106
var result = new DotnetCommand(Log, "run")
107107
.WithWorkingDirectory(testInstance.Path)
108108
.WithEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
109-
.Execute("--framework", "net9.0", "-p:Device=", "--no-interactive");
109+
.Execute("--framework", ToolsetInfo.CurrentTargetFramework, "-p:Device=", "--no-interactive");
110110

111111
result.Should().Fail()
112112
.And.HaveStdErrContaining(string.Format(CliCommandStrings.RunCommandExceptionUnableToRunSpecifyDevice, "--device"));
@@ -121,7 +121,7 @@ public void ItWorksWithDevicePropertySyntax()
121121
string deviceId = "test-device-1";
122122
new DotnetCommand(Log, "run")
123123
.WithWorkingDirectory(testInstance.Path)
124-
.Execute("--framework", "net9.0", $"-p:Device={deviceId}")
124+
.Execute("--framework", ToolsetInfo.CurrentTargetFramework, $"-p:Device={deviceId}")
125125
.Should().Pass()
126126
.And.HaveStdOutContaining($"Device: {deviceId}");
127127
}
@@ -135,7 +135,7 @@ public void ItWorksWithDeviceWithoutRuntimeIdentifier()
135135
string deviceId = "test-device-2";
136136
new DotnetCommand(Log, "run")
137137
.WithWorkingDirectory(testInstance.Path)
138-
.Execute("--framework", "net9.0", "--device", deviceId)
138+
.Execute("--framework", ToolsetInfo.CurrentTargetFramework, "--device", deviceId)
139139
.Should().Pass()
140140
.And.HaveStdOutContaining($"Device: {deviceId}")
141141
.And.HaveStdOutContaining("RuntimeIdentifier:");
@@ -152,7 +152,7 @@ public void ItAutoSelectsSingleDeviceWithoutPrompting(bool interactive)
152152
var command = new DotnetCommand(Log, "run")
153153
.WithWorkingDirectory(testInstance.Path);
154154

155-
var args = new List<string> { "--framework", "net9.0", "-p:SingleDevice=true" };
155+
var args = new List<string> { "--framework", ToolsetInfo.CurrentTargetFramework, "-p:SingleDevice=true" };
156156
if (!interactive)
157157
{
158158
args.Add("--no-interactive");
@@ -177,7 +177,7 @@ public void ItCreatesBinlogWhenRequestedForDeviceSelection()
177177

178178
var result = new DotnetCommand(Log, "run")
179179
.WithWorkingDirectory(testInstance.Path)
180-
.Execute("--framework", "net9.0", "--list-devices", "/bl:device-list.binlog");
180+
.Execute("--framework", ToolsetInfo.CurrentTargetFramework, "--list-devices", "/bl:device-list.binlog");
181181

182182
result.Should().Pass()
183183
.And.HaveStdOutContaining("test-device-1");
@@ -195,7 +195,7 @@ public void ItFailsWhenNoDevicesAreAvailable()
195195
var result = new DotnetCommand(Log, "run")
196196
.WithWorkingDirectory(testInstance.Path)
197197
.WithEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
198-
.Execute("--framework", "net9.0", "-p:NoDevices=true", "--no-interactive");
198+
.Execute("--framework", ToolsetInfo.CurrentTargetFramework, "-p:NoDevices=true", "--no-interactive");
199199

200200
result.Should().Fail()
201201
.And.HaveStdErrContaining(CliCommandStrings.RunCommandNoDevicesAvailable);
@@ -212,7 +212,7 @@ public void ItDoesNotRunComputeAvailableDevicesWhenDeviceIsPreSpecified(string d
212212

213213
string deviceSelectionBinlogPath = Path.Combine(testInstance.Path, "msbuild-dotnet-run-devices.binlog");
214214

215-
var args = new List<string> { "--framework", "net9.0" };
215+
var args = new List<string> { "--framework", ToolsetInfo.CurrentTargetFramework };
216216
if (deviceArgPrefix == "--device")
217217
{
218218
args.Add("--device");

0 commit comments

Comments
 (0)