Migrate now moves all file copies to the None element.
This commit is contained in:
parent
3bbfcb428b
commit
14a7dd7ef1
7 changed files with 26 additions and 26 deletions
|
@ -147,11 +147,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
||||||
new RemoveContextTransform("EmbeddedResource", condition: ic => ic != null);
|
new RemoveContextTransform("EmbeddedResource", condition: ic => ic != null);
|
||||||
|
|
||||||
private IncludeContextTransform CopyToOutputFilesTransform =>
|
private IncludeContextTransform CopyToOutputFilesTransform =>
|
||||||
new IncludeContextTransform("Content", transformMappings: true)
|
new IncludeContextTransform("None", transformMappings: true)
|
||||||
.WithMetadata("CopyToOutputDirectory", "PreserveNewest");
|
.WithMetadata("CopyToOutputDirectory", "PreserveNewest");
|
||||||
|
|
||||||
private IncludeContextTransform CopyToOutputFilesTransformForWeb =>
|
private IncludeContextTransform CopyToOutputFilesTransformForWeb =>
|
||||||
new UpdateContextTransform("Content", transformMappings: true)
|
new UpdateContextTransform("None", transformMappings: true)
|
||||||
.WithMetadata("CopyToOutputDirectory", "PreserveNewest");
|
.WithMetadata("CopyToOutputDirectory", "PreserveNewest");
|
||||||
|
|
||||||
private AddPropertyTransform<Project> GenerateRuntimeConfigurationFilesTransform =>
|
private AddPropertyTransform<Project> GenerateRuntimeConfigurationFilesTransform =>
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
||||||
packOptions => !string.IsNullOrEmpty(packOptions.RepositoryUrl));
|
packOptions => !string.IsNullOrEmpty(packOptions.RepositoryUrl));
|
||||||
|
|
||||||
private IncludeContextTransform PackFilesTransform =>
|
private IncludeContextTransform PackFilesTransform =>
|
||||||
new IncludeContextTransform("Content", transformMappings: true)
|
new IncludeContextTransform("None", transformMappings: true)
|
||||||
.WithMetadata("Pack", "true")
|
.WithMetadata("Pack", "true")
|
||||||
.WithMappingsToTransform(_mappingsToTransfrom);
|
.WithMappingsToTransform(_mappingsToTransfrom);
|
||||||
|
|
||||||
|
|
|
@ -41,11 +41,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
||||||
}
|
}
|
||||||
|
|
||||||
private IncludeContextTransform CopyToPublishDirectoryTransform =>
|
private IncludeContextTransform CopyToPublishDirectoryTransform =>
|
||||||
new IncludeContextTransform("Content", transformMappings: true)
|
new IncludeContextTransform("None", transformMappings: true)
|
||||||
.WithMetadata("CopyToPublishDirectory", "PreserveNewest");
|
.WithMetadata("CopyToPublishDirectory", "PreserveNewest");
|
||||||
|
|
||||||
private IncludeContextTransform CopyToPublishDirectoryTransformForWeb =>
|
private IncludeContextTransform CopyToPublishDirectoryTransformForWeb =>
|
||||||
new UpdateContextTransform("Content", transformMappings: true)
|
new UpdateContextTransform("None", transformMappings: true)
|
||||||
.WithMetadata("CopyToPublishDirectory", "PreserveNewest");
|
.WithMetadata("CopyToPublishDirectory", "PreserveNewest");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -453,7 +453,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("compile", "Compile", 3, "")]
|
[InlineData("compile", "Compile", 3, "")]
|
||||||
[InlineData("embed", "EmbeddedResource", 3, ";rootfile.cs")]
|
[InlineData("embed", "EmbeddedResource", 3, ";rootfile.cs")]
|
||||||
[InlineData("copyToOutput", "Content", 2, ";rootfile.cs")]
|
[InlineData("copyToOutput", "None", 2, ";rootfile.cs")]
|
||||||
private void MigratingGroupIncludeExcludePopulatesAppropriateProjectItemElement(
|
private void MigratingGroupIncludeExcludePopulatesAppropriateProjectItemElement(
|
||||||
string group,
|
string group,
|
||||||
string itemName,
|
string itemName,
|
||||||
|
@ -529,7 +529,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("compile", "Compile", "")]
|
[InlineData("compile", "Compile", "")]
|
||||||
[InlineData("embed", "EmbeddedResource", ";rootfile.cs")]
|
[InlineData("embed", "EmbeddedResource", ";rootfile.cs")]
|
||||||
[InlineData("copyToOutput", "Content", ";rootfile.cs")]
|
[InlineData("copyToOutput", "None", ";rootfile.cs")]
|
||||||
private void MigratingGroupIncludeOnlyPopulatesAppropriateProjectItemElement(
|
private void MigratingGroupIncludeOnlyPopulatesAppropriateProjectItemElement(
|
||||||
string group,
|
string group,
|
||||||
string itemName,
|
string itemName,
|
||||||
|
@ -725,7 +725,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
|
|
||||||
private static void VerifyContentMetadata(ProjectItemElement item)
|
private static void VerifyContentMetadata(ProjectItemElement item)
|
||||||
{
|
{
|
||||||
if (item.ItemType == "Content")
|
if (item.ItemType == "None")
|
||||||
{
|
{
|
||||||
item.Metadata.Count(m => m.Name == "CopyToOutputDirectory").Should().Be(1);
|
item.Metadata.Count(m => m.Name == "CopyToOutputDirectory").Should().Be(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
}
|
}
|
||||||
}");
|
}");
|
||||||
|
|
||||||
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
|
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
|
||||||
|
|
||||||
contentItems.Count().Should().Be(4);
|
contentItems.Count().Should().Be(4);
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
}
|
}
|
||||||
}");
|
}");
|
||||||
|
|
||||||
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
|
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
|
||||||
|
|
||||||
contentItems.Count().Should().Be(5);
|
contentItems.Count().Should().Be(5);
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
}
|
}
|
||||||
}");
|
}");
|
||||||
|
|
||||||
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
|
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
|
||||||
|
|
||||||
contentItems.Count().Should().Be(2);
|
contentItems.Count().Should().Be(2);
|
||||||
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(2);
|
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(2);
|
||||||
|
@ -338,7 +338,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
}
|
}
|
||||||
}");
|
}");
|
||||||
|
|
||||||
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
|
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
|
||||||
|
|
||||||
contentItems.Count().Should().Be(3);
|
contentItems.Count().Should().Be(3);
|
||||||
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(3);
|
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(3);
|
||||||
|
@ -410,7 +410,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
}
|
}
|
||||||
}");
|
}");
|
||||||
|
|
||||||
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
|
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
|
||||||
|
|
||||||
contentItems.Count().Should().Be(4);
|
contentItems.Count().Should().Be(4);
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
}
|
}
|
||||||
}");
|
}");
|
||||||
|
|
||||||
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
|
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
|
||||||
|
|
||||||
contentItems.Count().Should().Be(5);
|
contentItems.Count().Should().Be(5);
|
||||||
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(3);
|
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(3);
|
||||||
|
|
|
@ -200,7 +200,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
}");
|
}");
|
||||||
|
|
||||||
var contentItems = mockProj.Items
|
var contentItems = mockProj.Items
|
||||||
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal))
|
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
|
||||||
.Where(item => item.GetMetadataWithName("Pack").Value == "true");
|
.Where(item => item.GetMetadataWithName("Pack").Value == "true");
|
||||||
|
|
||||||
contentItems.Count().Should().Be(1);
|
contentItems.Count().Should().Be(1);
|
||||||
|
@ -223,7 +223,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
}");
|
}");
|
||||||
|
|
||||||
var contentItems = mockProj.Items
|
var contentItems = mockProj.Items
|
||||||
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal))
|
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
|
||||||
.Where(item =>
|
.Where(item =>
|
||||||
item.GetMetadataWithName("Pack").Value == "true" &&
|
item.GetMetadataWithName("Pack").Value == "true" &&
|
||||||
item.GetMetadataWithName("PackagePath") != null);
|
item.GetMetadataWithName("PackagePath") != null);
|
||||||
|
@ -250,7 +250,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
}");
|
}");
|
||||||
|
|
||||||
var contentItems = mockProj.Items
|
var contentItems = mockProj.Items
|
||||||
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal))
|
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
|
||||||
.Where(item =>
|
.Where(item =>
|
||||||
item.GetMetadataWithName("Pack").Value == "true" &&
|
item.GetMetadataWithName("Pack").Value == "true" &&
|
||||||
item.GetMetadataWithName("PackagePath") != null);
|
item.GetMetadataWithName("PackagePath") != null);
|
||||||
|
@ -284,7 +284,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
});
|
});
|
||||||
|
|
||||||
var contentItems = mockProj.Items
|
var contentItems = mockProj.Items
|
||||||
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal))
|
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
|
||||||
.Where(item =>
|
.Where(item =>
|
||||||
item.GetMetadataWithName("Pack").Value == "true" &&
|
item.GetMetadataWithName("Pack").Value == "true" &&
|
||||||
item.GetMetadataWithName("PackagePath") != null);
|
item.GetMetadataWithName("PackagePath") != null);
|
||||||
|
|
|
@ -32,9 +32,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
}",
|
}",
|
||||||
testDirectory: testDirectory);
|
testDirectory: testDirectory);
|
||||||
|
|
||||||
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(2);
|
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(2);
|
||||||
|
|
||||||
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal)))
|
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
|
||||||
{
|
{
|
||||||
item.Metadata.Count(m => m.Name == "CopyToPublishDirectory").Should().Be(1);
|
item.Metadata.Count(m => m.Name == "CopyToPublishDirectory").Should().Be(1);
|
||||||
|
|
||||||
|
@ -82,9 +82,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
}",
|
}",
|
||||||
testDirectory: testDirectory);
|
testDirectory: testDirectory);
|
||||||
|
|
||||||
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(2);
|
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(2);
|
||||||
|
|
||||||
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal)))
|
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
|
||||||
{
|
{
|
||||||
item.Metadata.Count(m => m.Name == "CopyToPublishDirectory").Should().Be(1);
|
item.Metadata.Count(m => m.Name == "CopyToPublishDirectory").Should().Be(1);
|
||||||
|
|
||||||
|
@ -126,13 +126,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
}",
|
}",
|
||||||
testDirectory: testDirectory);
|
testDirectory: testDirectory);
|
||||||
|
|
||||||
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(3);
|
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(3);
|
||||||
|
|
||||||
// From ProjectReader #L725 (Both are empty)
|
// From ProjectReader #L725 (Both are empty)
|
||||||
var defaultIncludePatterns = Enumerable.Empty<string>();
|
var defaultIncludePatterns = Enumerable.Empty<string>();
|
||||||
var defaultExcludePatterns = Enumerable.Empty<string>();
|
var defaultExcludePatterns = Enumerable.Empty<string>();
|
||||||
|
|
||||||
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal)))
|
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
|
||||||
{
|
{
|
||||||
if (item.Include.Contains(@"root\**\*"))
|
if (item.Include.Contains(@"root\**\*"))
|
||||||
{
|
{
|
||||||
|
@ -189,13 +189,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
||||||
}",
|
}",
|
||||||
testDirectory: testDirectory);
|
testDirectory: testDirectory);
|
||||||
|
|
||||||
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(3);
|
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(3);
|
||||||
|
|
||||||
// From ProjectReader #L725 (Both are empty)
|
// From ProjectReader #L725 (Both are empty)
|
||||||
var defaultIncludePatterns = Enumerable.Empty<string>();
|
var defaultIncludePatterns = Enumerable.Empty<string>();
|
||||||
var defaultExcludePatterns = Enumerable.Empty<string>();
|
var defaultExcludePatterns = Enumerable.Empty<string>();
|
||||||
|
|
||||||
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal)))
|
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
|
||||||
{
|
{
|
||||||
var metadata = string.Join(",", item.Metadata.Select(m => m.Name));
|
var metadata = string.Join(",", item.Metadata.Select(m => m.Name));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue