Exemple #1
0
        private void GenerateInternal(MasterInfo masterInfo, CsprojSettings csprojSettings)
        {
            XDocument?backup   = null;
            XDocument?document = null;

            try
            {
                backup   = ReadDocument(masterInfo.ProjectInfo.CsprojPath);
                document = ReadDocument(masterInfo.ProjectInfo.CsprojPath);

                ClearFile(masterInfo.ProjectInfo.CsprojPath);

                ClearDocument(document);

                FillDocument(document, csprojSettings);

                WriteDocumentToFile(masterInfo.ProjectInfo.CsprojPath, document);
            }
            catch (Exception ex)
            {
                document = null;

                Console.WriteLine("Something goes wrong");
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);

                throw;
            }
            finally
            {
                if (backup != null && document == null)
                {
                    WriteDocumentToFile(masterInfo.ProjectInfo.CsprojPath, backup);
                }
            }
        }
Exemple #2
0
 private void FillDocument(XDocument document, CsprojSettings csprojSettings)
 {
     document.Root.AddFirst(csprojSettings.ProjectWideGroup, csprojSettings.DebugGroup, csprojSettings.ReleaseGroup);
 }