Yet more migration

This commit is contained in:
Piotr Puszkiewicz 2016-12-16 21:05:59 -08:00 committed by Livar Cunha
parent 91061c2296
commit 469abc2d96
3 changed files with 16 additions and 6 deletions

View file

@ -29,6 +29,10 @@ namespace Microsoft.DotNet.ProjectJsonMigration
public const string CannotMergeItemsWithoutCommonIncludeError = "Cannot merge items without a common include.";
public const string PropertyTransformApplicatorWrongElementTypeError = "Expected element to be of type {0}, but got {1}";
public const string UnexpectedTypeError = "Unexpected type {0}";
public const string MIGRATE1011 = "Deprecated Project";
public const string MIGRATE1012 = "Project not Restored";
@ -112,5 +116,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration
public const string ItemTransformApplicatorMergingItemWithExistingItemsSameChain = "{0}: Merging Item with {1} existing items with the same condition chain.";
public const string ItemTransformApplicatorAddingMergedItem = "{0}: Adding Merged Item {{ ItemType: {1}, Condition: {2}, Include: {3}, Exclude: {4} }}";
public const string MergingProperty = "Merging property, output merged property";
public const string IgnoringMergedProperty = "Ignoring fully merged property";
public const string PropertyInfo = "{0}: {message}, {{ Name={1}, Value={2} }}";
}
}

View file

@ -20,12 +20,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
{
if (typeof(T) != typeof(ProjectPropertyElement))
{
throw new ArgumentException($"Expected element to be of type {nameof(ProjectPropertyElement)}, but got {nameof(T)}");
throw new ArgumentException(String.Format(LocalizableStrings.PropertyTransformApplicatorWrongElementTypeError, nameof(ProjectPropertyElement), nameof(T)));
}
if (typeof(U) != typeof(ProjectPropertyGroupElement))
{
throw new ArgumentException($"Expected element to be of type {nameof(ProjectPropertyGroupElement)}, but got {nameof(U)}");
throw new ArgumentException(String.Format(LocalizableStrings.PropertyTransformApplicatorWrongElementTypeError, nameof(ProjectPropertyGroupElement), nameof(U)));
}
if (element == null)
@ -41,12 +41,12 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
var mergedProperty = MergePropertyWithProject(property, destinationPropertyGroup);
if (mergedProperty != null && !string.IsNullOrEmpty(mergedProperty.Value))
{
TracePropertyInfo("Merging property, output merged property", mergedProperty);
TracePropertyInfo(LocalizableStrings.MergingProperty, mergedProperty);
AddPropertyToPropertyGroup(mergedProperty, destinationPropertyGroup);
}
else
{
TracePropertyInfo("Ignoring fully merged property", property);
TracePropertyInfo(LocalizableStrings.IgnoringMergedProperty, property);
}
}
else
@ -125,7 +125,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
private void TracePropertyInfo(string message, ProjectPropertyElement mergedProperty)
{
MigrationTrace.Instance.WriteLine($"{nameof(PropertyTransformApplicator)}: {message}, {{ Name={mergedProperty.Name}, Value={mergedProperty.Value} }}");
MigrationTrace.Instance.WriteLine(String.Format(LocalizableStrings.PropertyInfo, nameof(PropertyTransformApplicator), mergedProperty.Name, mergedProperty.Value));
}
}
}

View file

@ -35,7 +35,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
}
else
{
throw new ArgumentException($"Unexpected type {nameof(T)}");
throw new ArgumentException(String.Format(LocalizableStrings.UnexpectedTypeError, nameof(T)));
}
}