private ITaskItem GenerateUnoPRIResources(string language, DateTime sourceLastWriteTime, Dictionary <string, string> resources, string comment)
        {
            var logicalTargetPath = Path.Combine($"{language}", "resources.upri");
            var actualTargetPath  = Path.Combine(OutputPath, logicalTargetPath);

            Directory.CreateDirectory(Path.GetDirectoryName(actualTargetPath));

            var targetLastWriteTime = new FileInfo(actualTargetPath).LastWriteTimeUtc;

            if (sourceLastWriteTime > targetLastWriteTime)
            {
                this.Log().Info("Writing resources to {0}".InvariantCultureFormat(actualTargetPath));

                UnoPRIResourcesWriter.Write(language, resources, actualTargetPath, comment);
            }
            else
            {
                this.Log().Info($"Skipping unmodified file {actualTargetPath}");
            }

            return(new TaskItem
                   (
                       actualTargetPath,
                       new Dictionary <string, string>()
            {
                { "UnoResourceTarget", "Uno" },
                { "LogicalName", logicalTargetPath.Replace(Path.DirectorySeparatorChar, '.') }
            }
                   ));
        }
        private ITaskItem GenerateUnoPRIResources(string language, DateTime sourceLastWriteTime, Dictionary <string, string> resources, string comment, ITaskItem resource)
        {
            string buildBasePath()
            {
                if (Path.IsPathRooted(resource.ItemSpec))
                {
                    string definingProjectDirectory = resource.GetMetadata("DefiningProjectDirectory");
                    if (resource.ItemSpec.StartsWith(definingProjectDirectory))
                    {
                        return(resource.ItemSpec.Replace(definingProjectDirectory, ""));
                    }
                    else if (resource.ItemSpec.StartsWith(TargetProjectDirectory))
                    {
                        return(resource.ItemSpec.Replace(TargetProjectDirectory, ""));
                    }
                    else
                    {
                        return(language);
                    }
                }
                else
                {
                    return(Path.GetDirectoryName(resource.ItemSpec));
                }
            }

            var resourceMapName   = Path.GetFileNameWithoutExtension(resource.ItemSpec);
            var logicalTargetPath = Path.Combine(buildBasePath(), resourceMapName + ".upri");
            var actualTargetPath  = Path.Combine(OutputPath, logicalTargetPath);

            Directory.CreateDirectory(Path.GetDirectoryName(actualTargetPath));

            var targetLastWriteTime = new FileInfo(actualTargetPath).LastWriteTimeUtc;

            if (sourceLastWriteTime > targetLastWriteTime)
            {
                Log.LogMessage($"Writing resources to {actualTargetPath}");

                UnoPRIResourcesWriter.Write(resourceMapName, language, resources, actualTargetPath, comment);
            }
            else
            {
                Log.LogMessage($"Skipping unmodified file {actualTargetPath}");
            }

            return(new TaskItem
                   (
                       actualTargetPath,
                       new Dictionary <string, string>()
            {
                { "UnoResourceTarget", "Uno" },
                { "LogicalName", logicalTargetPath.Replace(Path.DirectorySeparatorChar, '.') }
            }
                   ));
        }