title: How can I add an MSBuild Import with IVsBuildPropertyStorage?
body: <p>I'm trying to add an Import task to a .csproj file programmatically, but I don't want to use the Microsoft.Build.BuildEngine objects to do this because VS will then pop up warnings about the project file being modified from outside of Visual Studio.</p>
  
  <p>I've seen a few pages [1] [2] suggesting that the IVsBuildPropertyStorage interface will let me access the MSBuild parts of the .csproj file, but I'm having trouble figuring out how to do this, or if it's even possible really.  It looks like I need to specify the name of the property I want to access, but I'm not sure how to figure that out.  Calling GetPropertyValue() for an "Import" property doesn't return anything for project files that are already set up how I want my final results to look:</p>
  
  <pre><code>EnvDTE.Project proj = ...;
  var sol = Package.GetGlobalService(typeof(VsSolution)) as IVsSolution;
  IVsHierarchy hier;
  sol.GetProjectOfUniqueName(p.UniqueName, out hier);
  var storage = hier as IVsBuildPropertyStorage;
  string val;
  storage.GetPropertyValue("Import", String.Empty,
                           (uint)_PersistStorageType.PST_PROJECT_FILE, out val);
  // val is null
  </code></pre>
  
  <p>[1] <a href="https://mpfproj.svn.codeplex.com/svn/9.0/Tests/UnitTests/ProjectTest.cs" rel="nofollow noreferrer">https://mpfproj.svn.codeplex.com/svn/9.0/Tests/UnitTests/ProjectTest.cs</a>
  <br>[2] <a href="http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/e1983591-120a-4a2f-a910-e596dd625e68" rel="nofollow noreferrer">http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/e1983591-120a-4a2f-a910-e596dd625e68</a></p>
  
  <p>Thanks.  I'd appreciate any suggestions I can get with this.</p>