I'm working on a VS plugin for handling a new test type. One of the things we want to do is add an MSBuild import to the project file when one of our tests is in the test project, to run our custom build tasks.
I can add the import element by using Microsoft.Build.BuildEngine.Project.Imports, but if I save the project file via the BuildEngine object I get a "File has been modified outside of Visual Studio" warning. Adding new Imports to the Project.Imports collection doesn't seem to mark the project as dirty in Visual Studio though, so I can't rely on VS to save the file correctly normally.
Is there any way I can access this part of MSBuild functionality through the DTE.Project or VSLangProj.Project objects?
Thanks.