diff --git a/src/Microsoft.Android.Templates/androidtest/AndroidTest1.csproj b/src/Microsoft.Android.Templates/androidtest/AndroidTest1.csproj
index b1fe0091ac2..f0c5dbe9df5 100644
--- a/src/Microsoft.Android.Templates/androidtest/AndroidTest1.csproj
+++ b/src/Microsoft.Android.Templates/androidtest/AndroidTest1.csproj
@@ -18,7 +18,7 @@
-
+
diff --git a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
index d9aff0ceac0..0fd71db7806 100644
--- a/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
+++ b/tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
@@ -2480,12 +2480,19 @@ public void StartAndroidActivityRespectsAndroidDeviceUserId ()
"The 'am start' command should contain '--user 0' when AndroidDeviceUserId is set.");
}
+ public enum MSTestPackageChannel
+ {
+ Stable,
+ Nightly,
+ }
+
[Test]
- [TestCase ("run", AndroidRuntime.CoreCLR)]
- [TestCase ("test", AndroidRuntime.CoreCLR)]
- public void DotNetNewAndroidTest (string mode, AndroidRuntime runtime)
+ [TestCase ("run", MSTestPackageChannel.Nightly)]
+ [TestCase ("test", MSTestPackageChannel.Stable)]
+ [TestCase ("test", MSTestPackageChannel.Nightly)]
+ public void DotNetNewAndroidTest (string mode, MSTestPackageChannel msTestPackageChannel)
{
- var templateName = $"DotNetNewAndroidTest_{mode}_{runtime}";
+ var templateName = $"DotNetNewAndroidTest_{mode}_{msTestPackageChannel}";
var projectDirectory = Path.Combine (Root, "temp", templateName);
if (Directory.Exists (projectDirectory))
Directory.Delete (projectDirectory, true);
@@ -2494,22 +2501,21 @@ public void DotNetNewAndroidTest (string mode, AndroidRuntime runtime)
var dotnet = new DotNetCLI (Path.Combine (projectDirectory, $"{templateName}.csproj"));
Assert.IsTrue (dotnet.New ("androidtest"), "`dotnet new androidtest` should succeed");
- // Override the MSTest version from the template with the version used by our build
- var msTestVersion = GetAssemblyMetadataValue ("MSTestPackageVersion");
- var csprojPath = Path.Combine (projectDirectory, $"{templateName}.csproj");
- var doc = XDocument.Load (csprojPath);
- var ns = doc.Root?.Name.Namespace ?? XNamespace.None;
- var msTestRef = doc.Descendants (ns + "PackageReference")
- .FirstOrDefault (e => e.Attribute ("Include")?.Value == "MSTest");
- Assert.IsNotNull (msTestRef, "MSTest PackageReference should exist in the generated project");
- msTestRef.SetAttributeValue ("Version", msTestVersion);
- doc.Save (csprojPath);
-
- bool useMonoRuntime = runtime == AndroidRuntime.MonoVM;
- var buildParameters = new List {
- $"UseMonoRuntime={useMonoRuntime}",
- "RestoreAdditionalProjectSources=https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json",
- };
+ var buildParameters = new List ();
+
+ if (msTestPackageChannel == MSTestPackageChannel.Nightly) {
+ // Override the stable template version with the version used by our build.
+ var msTestVersion = GetAssemblyMetadataValue ("MSTestPackageVersion");
+ var csprojPath = Path.Combine (projectDirectory, $"{templateName}.csproj");
+ var doc = XDocument.Load (csprojPath);
+ var ns = doc.Root?.Name.Namespace ?? XNamespace.None;
+ var msTestRef = doc.Descendants (ns + "PackageReference")
+ .FirstOrDefault (e => e.Attribute ("Include")?.Value == "MSTest");
+ Assert.IsNotNull (msTestRef, "MSTest PackageReference should exist in the generated project");
+ msTestRef.SetAttributeValue ("Version", msTestVersion);
+ doc.Save (csprojPath);
+ buildParameters.Add ("RestoreAdditionalProjectSources=https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json");
+ }
// Build and assert 0 warnings
Assert.IsTrue (dotnet.Build (parameters: buildParameters.ToArray ()), "`dotnet build` should succeed");