Adding a work around for publishing self-contained apps to RIDs that are not available for Microsoft.NETCore.App 2.0.0.

This commit is contained in:
Livar Cunha 2018-03-30 17:57:03 -07:00
parent 9b68d55059
commit 370243ab81

View file

@ -4,7 +4,9 @@
using System;
using System.IO;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Xml.Linq;
using FluentAssertions;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.PlatformAbstractions;
@ -103,7 +105,19 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles();
.WithProjectChanges(project =>
{
var ns = project.Root.Name.Namespace;
var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First();
// This is needed to be able to restore for RIDs that were not available in Microsoft.NetCore.App 2.0.0.
// M.NC.App 2.0.0 depends on a version of Microsoft.NetCore.Platforms that lacks the mapping for the
// latest RIDs. Given that self-contained apps are pinned to 2.0.0 in this version of the SDK, we
// need a manual roll-forward.
propertyGroup.Add(
new XElement(ns + "RuntimeFrameworkVersion", "2.0.*"));
});
var testProjectDirectory = testInstance.Root;
@ -170,7 +184,19 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
var testInstance = TestAssets.Get(testAppName)
.CreateInstance($"PublishesSelfContained{selfContained}")
.WithSourceFiles()
.WithRestoreFiles();
.WithProjectChanges(project =>
{
var ns = project.Root.Name.Namespace;
var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First();
// This is needed to be able to restore for RIDs that were not available in Microsoft.NetCore.App 2.0.0.
// M.NC.App 2.0.0 depends on a version of Microsoft.NetCore.Platforms that lacks the mapping for the
// latest RIDs. Given that self-contained apps are pinned to 2.0.0 in this version of the SDK, we
// need a manual roll-forward.
propertyGroup.Add(
new XElement(ns + "RuntimeFrameworkVersion", "2.0.*"));
});
var testProjectDirectory = testInstance.Root;