Skip to content

Commit

Permalink
Fixes #11
Browse files Browse the repository at this point in the history
  • Loading branch information
hvanbakel committed Jun 8, 2017
1 parent b13dcda commit 0beb8d4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions Project2015To2017/Definition/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal sealed class Project
public IReadOnlyList<XElement> ItemsToInclude { get; internal set; }
public PackageConfiguration PackageConfiguration { get; internal set; }
public AssemblyAttributes AssemblyAttributes { get; internal set; }
public IReadOnlyList<XElement> ConditionalPropertyGroups { get; internal set; }

public IReadOnlyList<string> TargetFrameworks { get; internal set; }
public ApplicationType Type { get; internal set; }
Expand Down
8 changes: 1 addition & 7 deletions Project2015To2017/FileTransformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ private static IReadOnlyList<XElement> FindNonWildcardMatchedFiles(
var includeAttribute = compiledFile.Attribute("Include");
if (includeAttribute != null)
{
Console.WriteLine(includeAttribute.Value);
if (!Path.GetFullPath(Path.Combine(projectFolder.FullName, includeAttribute.Value)).StartsWith(projectFolder.FullName))
{
Console.WriteLine($"Include cannot be done through wildcard, adding as separate include {compiledFile.ToString()}.");
Expand All @@ -72,7 +71,6 @@ private static IReadOnlyList<XElement> FindNonWildcardMatchedFiles(
var dependentUpon = compiledFile.Element(elementName.Namespace + "DependentUpon");
if (dependentUpon != null && dependentUpon.Value.EndsWith(".resx", StringComparison.OrdinalIgnoreCase))
{
Console.WriteLine("Found resx generatedcode file.");
// resx generated code file
manualIncludes.Add(new XElement(
"Compile",
Expand Down Expand Up @@ -114,11 +112,7 @@ private static IReadOnlyList<XElement> FindNonWildcardMatchedFiles(
continue;
}

Console.WriteLine($"File found which was not included, will now create exclude for {nonListedFile}.");

manualIncludes.Add(new XElement(
"Compile",
new XAttribute("Exclude", nonListedFile.Substring(projectFolder.FullName.Length))));
Console.WriteLine($"File found which was not included, consider removing {nonListedFile}.");
}

foreach (var fileNotOnDisk in knownFullPaths.Except(filesInFolder).Where(x => x.StartsWith(projectFolder.FullName, StringComparison.OrdinalIgnoreCase)))
Expand Down
1 change: 1 addition & 0 deletions Project2015To2017/ProjectPropertiesTransformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public Task TransformAsync(XDocument projectFile, DirectoryInfo projectFolder, P
? ApplicationType.TestProject
: ToApplicationType(propertyGroups.Elements(nsSys + "OutputType").FirstOrDefault()?.Value);
definition.TargetFrameworks = new[] { ToTargetFramework(targetFramework) };
definition.ConditionalPropertyGroups = propertyGroups.Where(x => x.Attribute("Condition") != null).ToArray();

if (definition.Type == ApplicationType.Unkown)
{
Expand Down
5 changes: 5 additions & 0 deletions Project2015To2017/Writing/ProjectWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public void Write(Project project, FileInfo outputFile)

projectNode.Add(GetMainPropertyGroup(project, outputFile));

if (project.ConditionalPropertyGroups != null)
{
projectNode.Add(project.ConditionalPropertyGroups.Select(RemoveAllNamespaces));
}

if (project.ProjectReferences?.Count > 0)
{
var itemGroup = new XElement("ItemGroup");
Expand Down

0 comments on commit 0beb8d4

Please sign in to comment.