private static void PrepareOutputFileForCompilation(string sourceFile, string outputFile, string emptyFileConents)
        {
            // create a temporary file if it doesnt already exist so we can add to project etc if needed
            if (!System.IO.File.Exists(outputFile))
            {
                System.IO.File.WriteAllText(outputFile, emptyFileConents);
            }

            // ensure output file is in our project
            TsWspHelpers.AddOutputFileToSourceFilesProject(sourceFile, outputFile);

            // check it ouf if needed
            // (this doesnt work for Sourcegear Vault....)
            if (!TsWspHelpers.CheckOutFileFromSourceControl(outputFile))
            {
                //abort on failed checkout
                throw new ApplicationException("Failed to check out file " + outputFile);
            }

            // make non read only if permitted
            System.IO.FileInfo fi = new System.IO.FileInfo(outputFile);
            if (fi.Exists == true && fi.IsReadOnly)
            {
                if (TsWspSettings.Instance.OverwriteReadonly == true)
                {
                    TsWspHelpers.EnsureNotReadonly(outputFile);
                }

                fi.Refresh();

                if (fi.IsReadOnly)
                {
                    string msg = $"TsWspCompilation\r\nWill not be able to write file {outputFile}\r\nfrom source {sourceFile}\r\n{outputFile} is read only";
                    throw new ApplicationException(msg);
                }
            }
        }
 ///<summary>Saves the current settings to the specified settings file.</summary>
 private static void Save(string filename)
 {
     TsWspHelpers.CheckOutFileFromSourceControl(filename);
     TsWspSettings.Instance.WriteJsonFile(filename);
     UpdateStatusBar("updated");
 }