|
4 | 4 | using System; |
5 | 5 | using System.IO; |
6 | 6 | using System.Diagnostics; |
| 7 | +using System.Linq; |
7 | 8 | using System.Runtime.InteropServices; |
| 9 | +using System.Xml.Linq; |
8 | 10 | using FluentAssertions; |
9 | 11 | using Microsoft.DotNet.Cli.Utils; |
10 | 12 | using Microsoft.DotNet.PlatformAbstractions; |
@@ -103,7 +105,19 @@ public void ItPublishesARunnableSelfContainedApp() |
103 | 105 | var testInstance = TestAssets.Get(testAppName) |
104 | 106 | .CreateInstance() |
105 | 107 | .WithSourceFiles() |
106 | | - .WithRestoreFiles(); |
| 108 | + .WithProjectChanges(project => |
| 109 | + { |
| 110 | + var ns = project.Root.Name.Namespace; |
| 111 | + |
| 112 | + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); |
| 113 | + |
| 114 | + // This is needed to be able to restore for RIDs that were not available in Microsoft.NetCore.App 2.0.0. |
| 115 | + // M.NC.App 2.0.0 depends on a version of Microsoft.NetCore.Platforms that lacks the mapping for the |
| 116 | + // latest RIDs. Given that self-contained apps are pinned to 2.0.0 in this version of the SDK, we |
| 117 | + // need a manual roll-forward. |
| 118 | + propertyGroup.Add( |
| 119 | + new XElement(ns + "RuntimeFrameworkVersion", "2.0.*")); |
| 120 | + }); |
107 | 121 |
|
108 | 122 | var testProjectDirectory = testInstance.Root; |
109 | 123 |
|
@@ -170,7 +184,19 @@ private DirectoryInfo PublishAppWithSelfContained(string testAppName, bool selfC |
170 | 184 | var testInstance = TestAssets.Get(testAppName) |
171 | 185 | .CreateInstance($"PublishesSelfContained{selfContained}") |
172 | 186 | .WithSourceFiles() |
173 | | - .WithRestoreFiles(); |
| 187 | + .WithProjectChanges(project => |
| 188 | + { |
| 189 | + var ns = project.Root.Name.Namespace; |
| 190 | + |
| 191 | + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); |
| 192 | + |
| 193 | + // This is needed to be able to restore for RIDs that were not available in Microsoft.NetCore.App 2.0.0. |
| 194 | + // M.NC.App 2.0.0 depends on a version of Microsoft.NetCore.Platforms that lacks the mapping for the |
| 195 | + // latest RIDs. Given that self-contained apps are pinned to 2.0.0 in this version of the SDK, we |
| 196 | + // need a manual roll-forward. |
| 197 | + propertyGroup.Add( |
| 198 | + new XElement(ns + "RuntimeFrameworkVersion", "2.0.*")); |
| 199 | + }); |
174 | 200 |
|
175 | 201 | var testProjectDirectory = testInstance.Root; |
176 | 202 |
|
|
0 commit comments