public void CreateTransformFile()

in src/Microsoft.VisualStudio.SlowCheetah/Transformer/XmlTransformer.cs [43:77]


        public void CreateTransformFile(string sourcePath, string transformPath, bool overwrite)
        {
            if (string.IsNullOrWhiteSpace(sourcePath))
            {
                throw new ArgumentNullException(nameof(sourcePath));
            }

            if (string.IsNullOrWhiteSpace(transformPath))
            {
                throw new ArgumentNullException(nameof(transformPath));
            }

            if (!File.Exists(sourcePath))
            {
                throw new FileNotFoundException(Resources.Resources.ErrorMessage_SourceFileNotFound, sourcePath);
            }

            // If the file should be overwritten or if it doesn't exist, we create it
            if (overwrite || !File.Exists(transformPath))
            {
                XmlDocument transformDoc = new XmlDocument();
                using (XmlTextReader reader = new XmlTextReader(sourcePath))
                {
                    reader.DtdProcessing = DtdProcessing.Ignore;
                    transformDoc.Load(reader);
                }

                XmlComment xdtInfo = transformDoc.CreateComment(Resources.Resources.XmlTransform_ContentInfo);
                XmlElement root = transformDoc.DocumentElement;
                transformDoc.InsertBefore(xdtInfo, root);
                root.SetAttribute(XdtAttributeName, XdtAttributeValue);
                root.InnerXml = string.Empty;
                transformDoc.Save(transformPath);
            }
        }