예제 #1
0
        public void ExecuteCommand(string commandName, string commandArgs = "", int timeout = 25000)
        {
            Task task = Task.Factory.StartNew(() => {
                Console.WriteLine("Executing command {0} {1}", commandName, commandArgs);
                Dte.ExecuteCommand(commandName, commandArgs);
                Console.WriteLine("Successfully executed command {0} {1}", commandName, commandArgs);
            });

            bool timedOut = false;

            try {
                timedOut = !task.Wait(timeout);
            } catch (AggregateException ae) {
                foreach (var ex in ae.InnerExceptions)
                {
                    Console.WriteLine(ex.ToString());
                }
                ExceptionDispatchInfo.Capture(ae.InnerException).Throw();
            }

            if (timedOut)
            {
                string msg = String.Format("Command {0} failed to execute in specified timeout", commandName);
                Console.WriteLine(msg);
                DumpVS();
                Assert.Fail(msg);
            }
        }
예제 #2
0
        public ExecutionResult Execute(IExecutionContext executionContext, Keys key)
        {
            var state = CommandState.Handled;

            if (executionContext.Stack.Count > 0 && executionContext.Stack.Last() == Keys.D && key == Keys.D)
            {
                try
                {
                    Dte.ExecuteCommand("Edit.Delete");
                }
                catch (Exception e) { }

                executionContext = executionContext.Clear();
            }
            else if (key == Keys.D)
            {
                executionContext = executionContext.Add(key).With(delayedExecutable: this);
            }
            else
            {
                executionContext = executionContext.Clear();
                state            = CommandState.Cleared;
            }

            return(new ExecutionResult(executionContext, state));
        }
        public IntPtr OpenDialogWithDteExecuteCommand(string commandName, string commandArgs = "")
        {
            Task task = Task.Factory.StartNew(() => {
                Dte.ExecuteCommand(commandName, commandArgs);
                Console.WriteLine("Successfully executed command {0} {1}", commandName, commandArgs);
            });

            IntPtr dialog = IntPtr.Zero;

            try {
                dialog = WaitForDialog(task);
            } finally {
                if (dialog == IntPtr.Zero)
                {
                    if (task.IsFaulted && task.Exception != null)
                    {
                        Assert.Fail("Unexpected Exception - VSTestContext.DTE.ExecuteCommand({0},{1}){2}{3}",
                                    commandName, commandArgs, Environment.NewLine, task.Exception.ToString());
                    }
                    Assert.Fail("Task failed - VSTestContext.DTE.ExecuteCommand({0},{1})",
                                commandName, commandArgs);
                }
            }
            return(dialog);
        }
예제 #4
0
        public ExecutionResult Execute(IExecutionContext executionContext, Keys key)
        {
            try
            {
                Dte.ExecuteCommand("Edit.Paste");
            } catch (Exception e) { }

            return(new ExecutionResult(executionContext.Clear(), CommandState.Handled));
        }
 void FormatDocument()
 {
     try
     {
         Dte.ExecuteCommand("Edit.FormatDocument", string.Empty);
     }
     catch (COMException)
     {
     }
 }
예제 #6
0
 public ExecutionResult Execute(IExecutionContext executionContext, Keys key)
 {
     try
     {
         Dte.ExecuteCommand("Edit.Copy");
     }
     catch (Exception e) { }
     executionContext = executionContext.Clear().With(mode: InputMode.Normal);
     return(new ExecutionResult(executionContext, CommandState.Handled));
 }
 void RemoveAndSort()
 {
     try
     {
         Dte.ExecuteCommand("Edit.RemoveAndSort", string.Empty);
     }
     catch (COMException)
     {
     }
 }
예제 #8
0
 public ExecutionResult Execute(IExecutionContext executionContext, Keys key)
 {
     try
     {
         Dte.ExecuteCommand("View.Open");
         Dte.ExecuteCommand("Window.NewHorizontalTabGroup");
     }
     catch (Exception e) { }
     executionContext = executionContext.Clear().With(mode: InputMode.Normal);
     return(new ExecutionResult(executionContext, CommandState.Handled));
 }
예제 #9
0
        protected bool OpenSolutionWithPath(string solutionFile)
        {
            Assert.IsTrue(File.Exists(solutionFile), $"No Solution file at path: {solutionFile}");

            using (var waiting = new WaitUntil())
            {
                Dte.Events.SolutionEvents.Opened += () => waiting.Finish();

                Dte.ExecuteCommand("File.OpenProject", $"\"{solutionFile}\"");
            }
            return(true);
        }
예제 #10
0
        public void MoveCurrentFileToProject(string projectName)
        {
            ThreadPool.QueueUserWorkItem((x) => Dte.ExecuteCommand("file.ProjectPickerMoveInto"));
            IntPtr dialog = WaitForDialog();

            var chooseDialog = new ChooseLocationDialog(dialog);

            chooseDialog.FindProject(projectName);
            chooseDialog.ClickOK();

            WaitForDialogDismissed();
        }
예제 #11
0
 /// <summary>
 /// Opens and activates the solution explorer window.
 /// </summary>
 public void OpenPythonPerformance()
 {
     try {
         _deletePerformanceSessions = true;
         Dte.ExecuteCommand("Python.PerformanceExplorer");
     } catch {
         // If the package is not loaded yet then the command may not
         // work. Force load the package by opening the Launch dialog.
         using (var dialog = new PythonPerfTarget(OpenDialogWithDteExecuteCommand("Analyze.LaunchProfiling"))) {
         }
         Dte.ExecuteCommand("Python.PerformanceExplorer");
     }
 }
        public CommandResult ExecuteCommand(string command, string args = "", string success = null, string problem = null)
        {
            try
            {
                Dte?.ExecuteCommand(command, args);

                return(new SuccessResult(message: success));
            }
            catch (Exception ex)
            {
                return(new ProblemResult(message: problem ?? ex.ExtendedMessage()));
            }
        }
예제 #13
0
        public override void Execute()
        {
            var solution = Dte.GetSolutionClass();

            var solutionExplorer = Dte.GetSolutionExplorer();

            solutionExplorer.Activate();

            foreach (var project in solution.GetAllProjects())
            {
                Dte.SelectProject(project);
                Dte.ExecuteCommand(CommandNames.UnloadProjectCommandName);
            }
        }
예제 #14
0
 public ExecutionResult Execute(IExecutionContext executionContext, Keys key)
 {
     try
     {
         var selectedItem = Dte.SelectedItems.Item(1);
         if (selectedItem.Project != null)
         {
             Dte.ExecuteCommand("Project.ShowAllFiles");
         }
         else
         {
             Dte.ExecuteCommand("SolutionExplorer.Folder.ShowAllFiles");
         }
     }
     catch (Exception e) { }
     executionContext = executionContext.Clear().With(mode: InputMode.Normal);
     return(new ExecutionResult(executionContext, CommandState.Handled));
 }
        public void SaveAndLoadSuoTest()
        {
            var package    = (CmdArgsPackage)Utils.LoadPackage(new Guid(CmdArgsPackage.PackageGuidString));
            var project    = CreateSolutionWithProject();
            var properties = (CmdArgsOptionPage)package.GetDialogPage(typeof(CmdArgsOptionPage));

            properties.VcsSupport = false;

            InvokeInUIThread(() =>
            {
                var curList = package?.ToolWindowViewModel?.CurrentArgumentList;
                Assert.IsNotNull(curList);

                var initalCommands      = new[] { "arg1", "Arg2", "arg 3" };
                var initalEnabledStates = new[] { true, true, false };

                for (int i = 0; i < initalCommands.Length; i++)
                {
                    curList.AddNewItem(initalCommands[i], initalEnabledStates[i]);
                }

                Utils.ForceSaveSolution();

                var solutionFile = Dte.Solution.FullName;
                Assert.IsTrue(File.Exists(solutionFile));

                Dte.Solution.Close();

                Assert.IsNull(package.ToolWindowViewModel.CurrentArgumentList);

                Dte.ExecuteCommand("File.OpenProject", $"\"{solutionFile}\"");

                var curDataList = package?.ToolWindowViewModel?.CurrentArgumentList?.DataCollection;
                Assert.IsNotNull(curDataList);
                Assert.AreEqual(initalCommands.Length, curDataList.Count);
                for (int i = 0; i < initalCommands.Length; i++)
                {
                    var curItem = curDataList[i];
                    Assert.AreEqual(initalCommands[i], curItem.Command);
                    Assert.AreEqual(initalEnabledStates[i], curItem.Enabled);
                    Assert.AreNotEqual(Guid.Empty, curItem.Id);
                }
            });
        }
        public void RunFinished()
        {
            var projectFullName = Project.FullName;

            Dte.Solution.Remove(Project);
            var fInfoProject = new FileInfo(projectFullName);
            var dInfoProject = new DirectoryInfo(fInfoProject.DirectoryName ?? throw new InvalidOperationException());
            var folder       = dInfoProject.Parent?.FullName + "\\" + ProjectName;

            Utility.TryDeleteDirectory(folder);
            dInfoProject.MoveTo(folder);
            Dte.Solution.AddFromFile(dInfoProject.Parent?.FullName + "\\" + ProjectName + "\\" + ProjectName + ".csproj");
            Dte.Solution.SaveAs(Dte.Solution.FullName);
            var tfs = new Tfs(Dte);

            tfs.Undo(fInfoProject.DirectoryName);
            tfs.Add(dInfoProject.FullName);
            Dte.ExecuteCommand("SolutionExplorer.Refresh");
        }
예제 #17
0
        /// <summary>
        /// Opens and activates the Navigate To window.
        /// </summary>
        public NavigateToDialog OpenNavigateTo()
        {
            Task task = Task.Factory.StartNew(() =>
            {
                Dte.ExecuteCommand("Edit.NavigateTo");
                Console.WriteLine("Successfully executed Edit.NavigateTo");
            });

            for (int retries = 10; retries > 0; --retries)
            {
#if DEV12_OR_LATER
                foreach (var element in Element.FindAll(
                             TreeScope.Descendants,
                             new PropertyCondition(AutomationElement.ClassNameProperty, "Window")
                             ).OfType <AutomationElement>())
                {
                    if (element.FindAll(TreeScope.Children, new OrCondition(
                                            new PropertyCondition(AutomationElement.AutomationIdProperty, "PART_SearchHost"),
                                            new PropertyCondition(AutomationElement.AutomationIdProperty, "PART_ResultList")
                                            )).Count == 2)
                    {
                        return(new NavigateToDialog(element));
                    }
                }
#else
                var element = Element.FindFirst(
                    TreeScope.Descendants,
                    new AndCondition(
                        new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Window),
                        new PropertyCondition(AutomationElement.NameProperty, "Navigate To")
                        )
                    );
                if (element != null)
                {
                    return(new NavigateToDialog(element));
                }
#endif
                System.Threading.Thread.Sleep(500);
            }
            Assert.Fail("Could not find Navigate To window");
            return(null);
        }
 public void ProjectItemFinishedGenerating(ProjectItem projectItem)
 {
     if (CurrentProjectItem == null)
     {
         CurrentProjectItem = projectItem;
     }
     if (projectItem.Name.Contains(".generated.cs"))
     {
         ClassFileGenerated = projectItem.FileNames[0];
     }
     if (!ActiveProject.Name.EndsWith("Shared") && !projectItem.Name.Contains(".generated.cs"))
     {
         projectItem.ProjectItems.AddFromFile(ClassFileGenerated);
         projectItem.ContainingProject.Save();
     }
     if (IsNew && ActiveProject.Name.EndsWith($"{FormType.Shared.ToString()}"))
     {
         Dte.ExecuteCommand("File.SaveAll");
     }
 }
예제 #19
0
        public ExecutionResult Execute(IExecutionContext executionContext, Keys key)
        {
            try
            {
                Dte.ExecuteCommand("SolutionExplorer.ToggleSingleClickPreview");
                Dte.ExecuteCommand("SolutionExplorer.ToggleSingleClickPreview");
            }
            catch (Exception e)
            {
                this._hierarchyControl.GoUp();
                Dte.ExecuteCommand("SolutionExplorer.Folder.ToggleSingleClickPreview");
                this._hierarchyControl.GoDown();
                _timer          = new Timer();
                _timer.Interval = 500;
                _timer.Start();
                _timer.Tick += Timer_Tick;
            }

            executionContext = executionContext.Clear().With(mode: InputMode.Normal);
            return(new ExecutionResult(executionContext, CommandState.Handled));
        }
 public void RunFinished()
 {
     CloseWindows();
     if (!IsNew)
     {
         File.WriteAllText(ClassFileGenerated, GeneratedCode, System.Text.Encoding.UTF8);
     }
     else
     {
         if (!ActiveProject.Name.EndsWith($"{FormType.Shared.ToString()}"))
         {
             return;
         }
         var projectItemsFile = ActiveProject.FullName.Replace(".shproj", ".projitems");
         var lines            = File.ReadAllLines(projectItemsFile);
         var text             = string.Empty;
         var @class           = $"{Class}.cs";
         var fInfoProject     = new FileInfo(ActiveProject.FullName);
         var dic = fInfoProject.Directory?.FullName;
         if (dic != null)
         {
             var check = CurrentProjectItem.FileNames[0].Substring(dic.Length + 1);
             foreach (var line in lines)
             {
                 if (line.EndsWith($"{check + (char)34} />", StringComparison.Ordinal))
                 {
                     text += $"  <Compile Include=\"$(MSBuildThisFileDirectory){check}\">\r\n";
                     text += $"    <DependentUpon>{@class}</DependentUpon>\r\n";
                     text += $"  </Compile>\r\n";
                 }
                 else
                 {
                     text += line + "\r\n";
                 }
             }
         }
         File.WriteAllText(projectItemsFile, text, System.Text.Encoding.UTF8);
         Dte.ExecuteCommand("File.SaveAll");
     }
 }
예제 #21
0
        /// <summary>
        /// Selects the given source control provider.  Name merely needs to be enough text to disambiguate from other source control providers.
        /// </summary>
        public void SelectSourceControlProvider(string providerName)
        {
            Element.SetFocus();

            // bring up Tools->Options
            ThreadPool.QueueUserWorkItem(x => Dte.ExecuteCommand("Tools.Options"));

            // wait for it...
            IntPtr dialog = WaitForDialog();

            // go to the tree view which lets us select a set of options...
            var treeView = new TreeView(AutomationElement.FromHandle(dialog).FindFirst(TreeScope.Descendants,
                                                                                       new PropertyCondition(
                                                                                           AutomationElement.ClassNameProperty,
                                                                                           "SysTreeView32")
                                                                                       ));

            treeView.FindItem("Source Control", "Plug-in Selection").SetFocus();

            var currentSourceControl = new ComboBox(
                AutomationElement.FromHandle(dialog).FindFirst(
                    TreeScope.Descendants,
                    new AndCondition(
                        new PropertyCondition(
                            AutomationElement.NameProperty,
                            "Current source control plug-in:"
                            ),
                        new PropertyCondition(
                            AutomationElement.ClassNameProperty,
                            "ComboBox"
                            )
                        )
                    )
                );

            currentSourceControl.SelectItem(providerName);

            Keyboard.PressAndRelease(Key.Enter);
            WaitForDialogDismissed();
        }
        public void SetCommandLineArgsViaDebug(TestLanguage language)
        {
            OpenSolutionWithName(language, "ReadCmdArgsProject");
            LoadExtension();

            var args = new List <(string Arg, bool Enabled)>
            {
                ("Arg1", true),
                ("Arg42", false),
                ("Arg2", true),
            };

            var curList = ExtensionPackage.ToolWindowViewModel.CurrentArgumentList;

            InvokeInUIThread(() =>
            {
                foreach (var arg in args)
                {
                    curList.AddNewItem(arg.Arg, arg.Enabled);
                }
            });

            Dte.Solution.SolutionBuild.Build(true);
            using (var waiter = new WaitUntil())
            {
                Dte.Events.DebuggerEvents.OnEnterDesignMode += reason => waiter.Finish();
                Dte.ExecuteCommand("Debug.Start");
            }

            Assert.That(File.Exists("ReadCmdArgsProject/CmdLineArgs.txt"), Is.True);

            var cmdArgsFile = File.ReadAllText("ReadCmdArgsProject/CmdLineArgs.txt");
            var cmdArgsTest = string.Join(" ", args.Where(arg => arg.Enabled).Select(arg => arg.Arg));

            Assert.That(cmdArgsFile, Is.EqualTo(cmdArgsTest));
        }
예제 #23
0
 /// <summary>
 /// Opens and activates the Resource View window.
 /// </summary>
 public void OpenResourceView()
 {
     Dte.ExecuteCommand("View.ResourceView");
 }
예제 #24
0
 /// <summary>
 /// Opens and activates the object browser window.
 /// </summary>
 public void OpenObjectBrowser()
 {
     Dte.ExecuteCommand("View.ObjectBrowser");
     Dte.ExecuteCommand("View.ObjectBrowserSortObjectsAlphabetically");
 }
예제 #25
0
 /// <summary>
 /// Opens and activates the solution explorer window.
 /// </summary>
 public SolutionExplorerTree OpenSolutionExplorer()
 {
     _solutionExplorerTreeView = null;
     Dte.ExecuteCommand("View.SolutionExplorer");
     return(SolutionExplorerTreeView);
 }
예제 #26
0
 /// <summary>
 /// File->Save
 /// </summary>
 public void SaveSelection()
 {
     Dte.ExecuteCommand("File.SaveSelectedItems");
 }
예제 #27
0
 /// <summary>
 /// Opens and activates the test explorer window.
 /// </summary>
 public PythonTestExplorer OpenTestExplorer()
 {
     Dte.ExecuteCommand("TestExplorer.ShowTestExplorer");
     return(TestExplorer);
 }
        /// <summary>
        /// Code from Xsd2Code.Addin::Connect
        /// </summary>
        private void openConfigurationWindow()
        {
            ProjectItem proitem          = Dte.SelectedItems.Item(1).ProjectItem;
            Project     proj             = proitem.ContainingProject;
            string      projectDirectory = Path.GetDirectoryName(proj.FullName);

            // Try to get default nameSpace
            string defaultNamespace = string.Empty;
            uint?  targetFramework  = 0;
            bool?  isSilverlightApp = false;

            try
            {
                defaultNamespace = proj.Properties.Item("DefaultNamespace").Value as string;
                targetFramework  = proj.Properties.Item("TargetFramework").Value as uint?;
                isSilverlightApp = proj.Properties.Item("SilverlightProject.IsSilverlightApplication").Value as bool?;
            }
            catch
            {
            }

            string xsdFileName = proitem.FileNames[0];

            try
            {
                proitem.Save(xsdFileName);
            }
            catch (Exception)
            {
            }

            TargetFramework framework = TargetFramework.Net20;

            if (targetFramework.HasValue)
            {
                uint target = targetFramework.Value;
                switch (target)
                {
                case 196608:
                    framework = TargetFramework.Net30;
                    break;

                case 196613:
                    framework = TargetFramework.Net35;
                    break;

                case 262144:
                    framework = TargetFramework.Net40;
                    break;
                }
            }
            if (isSilverlightApp.HasValue)
            {
                if (isSilverlightApp.Value)
                {
                    framework = TargetFramework.Silverlight;
                }
            }

            // We associate an outputfile with the selected XSD file to know were to look for the parameters
            // TODO embed all the parameters as attributes of the XSD file in the project ?
            IVsHierarchy            hierarchy = null;
            uint                    itemid;
            string                  outputFile           = null;
            IVsBuildPropertyStorage buildPropertyStorage = null;

            if (IsSingleProjectItemSelection(out hierarchy, out itemid))
            {
                buildPropertyStorage = hierarchy as IVsBuildPropertyStorage;
                if (buildPropertyStorage != null)
                {
                    buildPropertyStorage.GetItemAttribute(itemid, "Xsd2CodeOutputFile", out outputFile);
                }
            }

            var frm = new FormOption();

            frm.Init(xsdFileName, proj.CodeModel.Language, defaultNamespace, framework, Path.IsPathRooted(outputFile) ? outputFile : Path.Combine(projectDirectory, outputFile ?? string.Empty));

            DialogResult result = frm.ShowDialog();

            GeneratorParams generatorParams = frm.GeneratorParams.Clone();

            generatorParams.InputFilePath = xsdFileName;

            var gen = new GeneratorFacade(generatorParams);

            bool foundOutputFile = false;

            if (xsdFileName.Length > 0)
            {
                if (result == DialogResult.OK)
                {
                    // Close file if open in IDE
                    ProjectItem projElmts = null;
                    if (!String.IsNullOrEmpty(outputFile))
                    {
                        string rootedOutputFile = Path.IsPathRooted(outputFile) ? outputFile : Path.Combine(projectDirectory, outputFile);
                        foundOutputFile = FindInProject(proj.ProjectItems, rootedOutputFile, out projElmts);
                        if (foundOutputFile)
                        {
                            Window window = projElmts.Open(EnvDTE.Constants.vsViewKindCode);
                            window.Close(vsSaveChanges.vsSaveChangesNo);
                        }
                    }

                    Result <List <string> > generateResult  = gen.Generate();
                    List <string>           outputFileNames = generateResult.Entity;

                    if (!generateResult.Success)
                    {
                        MessageBox.Show(generateResult.Messages.ToString(), "XSD2Code", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        string vsProjectOutputFilePath = outputFileNames[0];
                        // Save one of the output file path so we can read the parameters from it the next time
                        if (buildPropertyStorage != null)
                        {
                            buildPropertyStorage.SetItemAttribute(itemid, "Xsd2CodeOutputFile", GetRelativePath(vsProjectOutputFilePath, projectDirectory));
                        }

                        // try again now that the generation occured
                        string newRootedOutputFile = Path.Combine(projectDirectory, vsProjectOutputFilePath);
                        foundOutputFile = FindInProject(proj.ProjectItems, newRootedOutputFile, out projElmts);
                        if (!foundOutputFile)
                        {
                            projElmts = proj.ProjectItems.AddFromFile(newRootedOutputFile);
                        }


                        if (frm.OpenAfterGeneration && projElmts != null)
                        {
                            Window window = projElmts.Open(EnvDTE.Constants.vsViewKindCode);
                            window.Activate();
                            window.SetFocus();

                            try
                            {
                                // this.applicationObjectField.DTE.ExecuteCommand("Edit.RemoveAndSort", "");
                                Dte.ExecuteCommand("Edit.FormatDocument", string.Empty);
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                }
            }

            return;
        }
예제 #29
0
 /// <summary>
 /// Opens and activates the object browser window.
 /// </summary>
 public void OpenObjectBrowser()
 {
     Dte.ExecuteCommand("View.ObjectBrowser");
 }
예제 #30
0
        private void OnAppConfigFileChanged(object sender, AppConfigFileChangedEventArgs appConfigFileChangedEventArgs)
        {
//#if !DEBUG
            try
            {
//#endif
                if (_building || ((ConfigWatcher)sender).IsBuilding)
                {
                    return;
                }
                var    project = appConfigFileChangedEventArgs.Project;
                string projectFullName;
                try { projectFullName = project.FullName; } catch { return; }
                if (!project.IsAvailable() || !File.Exists(projectFullName))
                {
                    return;
                }
                var fileInfo          = new FileInfo(appConfigFileChangedEventArgs.AppConfigFile);
                var projectProperties = new ProjectProperties(project);
                if (projectProperties.InlineAppCfgTransforms != true)
                {
                    return;
                }
                var baseFileFullPath = appConfigFileChangedEventArgs.AppConfigFile;
                // $(MSBuildProjectDirectory)\$(ConfigDir)\$(AppCfgType).Base.config
                var tmpBaseFileFullPath = Path.Combine(project.GetDirectory(),
                                                       projectProperties.ConfigDir, projectProperties.AppCfgType + ".Base.config");
                if (File.Exists(tmpBaseFileFullPath))
                {
                    baseFileFullPath = tmpBaseFileFullPath;
                }
                lock (appConfigFileChangedMessageLock)
                {
                    var tmpGenFilePath = fileInfo.FullName + ".tmp";
                    var modifiedGeneratedConfigFileContents = File.ReadAllText(fileInfo.FullName);
                    if (!string.IsNullOrEmpty(baseFileFullPath) &&
                        baseFileFullPath != appConfigFileChangedEventArgs.AppConfigFile &&
                        DateTime.Now - _lastModifiedNotification > TimeSpan.FromSeconds(15) &&
                        Regex.Replace(modifiedGeneratedConfigFileContents, @"\s", "") != Regex.Replace(File.ReadAllText(baseFileFullPath), @"\s", ""))
                    {
                        // 1. re-run TransformXml
                        var xfrmFile = Path.Combine(project.GetDirectory(), projectProperties.ConfigDir,
                                                    projectProperties.AppCfgType + "."
                                                    + project.ConfigurationManager.ActiveConfiguration.ConfigurationName + ".config");
                        if (!File.Exists(xfrmFile))
                        {
                            File.Copy(baseFileFullPath, tmpGenFilePath, true);
                        }
                        else
                        {
                            var xfrm = new MSBuildXmlTransformer
                            {
                                Source      = baseFileFullPath,
                                Transform   = xfrmFile,
                                Destination = tmpGenFilePath
                            };
                            xfrm.Execute();
                        }
                        // 2. load transformxml output as string
                        var generatedConfigFileContents = File.ReadAllText(tmpGenFilePath);
                        // 3. delete tmp
                        File.Delete(tmpGenFilePath);
                        // 4. compare
                        if (generatedConfigFileContents == modifiedGeneratedConfigFileContents)
                        {
                            return;
                        }
                        var baseFileRelativePath = FileUtilities.GetRelativePath(
                            Directory.GetParent(project.GetDirectory()).FullName, baseFileFullPath, trimDotSlash: true);
                        MessageBox.Show(GetNativeWindow(),
                                        "The " + fileInfo.Name + " file has been modified, but "
                                        + "this is a generated file. You will need to immediately identify the changes that were made and "
                                        + "propagate them over to " + baseFileRelativePath, fileInfo.Name, MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                        _lastModifiedNotification = DateTime.Now;
                        Dte.ExecuteCommand("Tools.DiffFiles", "\"" + fileInfo.FullName + "\" \"" + baseFileFullPath + "\"");
                        _building = false;
                    }
                }
//#if !DEBUG
            }
            catch (Exception e)
            {
                Dte.GetLogger().LogError(e.GetType().Name + " - " + e.ToString());
            }
//#endif
        }