Пример #1
0
        protected virtual void WriteFile(SyntaxNode root, ITaskItem originalItem, Config config, TemplateResult result)
        {
            result.RemoveItem(originalItem);
            string filePath      = originalItem.GetMetadata("FullPath");
            string generatedFile = Path.Combine(Path.GetDirectoryName(filePath),
                                                $"{Path.GetFileNameWithoutExtension(filePath)}.g{Path.GetExtension(filePath)}");

            result.AddItem(new NewItem(generatedFile));
            using (var sw = new StreamWriter(generatedFile))
            {
                root.WriteTo(sw);
            }
        }