Exemplo n.º 1
0
        public bool Execute()
        {
            const string fullPath = "FullPath";
            string       src      = SourceFile.GetMetadata(fullPath);
            string       dest     = (DestinationFile?.GetMetadata(fullPath) ?? Path.Combine(Path.GetDirectoryName(BuildEngine.ProjectFileOfTaskNode), "appsettings.json"));

            foreach (string path in JPath.Split(new char[] { ';', ',' }, System.StringSplitOptions.RemoveEmptyEntries))
            {
                JsonEditor.CopyProperty(src, dest, path);
                BuildEngine.LogMessageEvent(new BuildMessageEventArgs(
                                                $"Copied  '{Path.GetFileName(src)}':'{path}' property to '{Path.GetFileName(dest)}'", null, nameof(CopyJsonProperties), MessageImportance.Normal));
            }

            return(true);
        }