-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #442 from tonyhallett/restore-project-file-when-re…
…moving-runsettings Save project file removes from git changes
- Loading branch information
Showing
3 changed files
with
54 additions
and
5 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
SharedProject/Core/MsTestPlatform/CodeCoverage/ProjectSaver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using Microsoft; | ||
using Microsoft.VisualStudio; | ||
using Microsoft.VisualStudio.Shell; | ||
using Microsoft.VisualStudio.Shell.Interop; | ||
using System; | ||
using System.ComponentModel.Composition; | ||
|
||
namespace FineCodeCoverage.Core.MsTestPlatform.CodeCoverage | ||
{ | ||
interface IProjectSaver | ||
{ | ||
void SaveProject(IVsHierarchy projectHierarchy); | ||
} | ||
|
||
[Export(typeof(IProjectSaver))] | ||
internal class ProjectSaver : IProjectSaver | ||
{ | ||
private IServiceProvider serviceProvider; | ||
|
||
[ImportingConstructor] | ||
public ProjectSaver( | ||
[Import(typeof(SVsServiceProvider))] | ||
IServiceProvider serviceProvider | ||
) | ||
{ | ||
this.serviceProvider = serviceProvider; | ||
} | ||
|
||
public void SaveProject(IVsHierarchy projectHierarchy) | ||
{ | ||
ThreadHelper.ThrowIfNotOnUIThread(); | ||
var _solution = (IVsSolution)serviceProvider.GetService(typeof(SVsSolution)); | ||
Assumes.Present(_solution); | ||
int hr = _solution.SaveSolutionElement((uint)__VSSLNSAVEOPTIONS.SLNSAVEOPT_SaveIfDirty, projectHierarchy, 0); | ||
if (ErrorHandler.Failed(hr)) | ||
{ | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters