title: Visual Studio 2010: How do I create and/or update a specific file within a Project from an Editor Extension?
body: <p>I am working on extending the spell checker that has recently been updated on the code gallery: <a href="http://code.msdn.microsoft.com/spellCheckerSample" rel="nofollow noreferrer">http://code.msdn.microsoft.com/spellCheckerSample</a></p>
  
  <p>I would like to update it so that the "ignore" list of words comes from <strong>CustomDictionary.xml</strong>, the same file that the static code analysis tools use.</p>
  
  <p>From within my VS 2010 editor extension, I need to:</p>
  
  <ol>
  <li>Find the project in which the current file resides.</li>
  <li>Find the "CustomDictionary.XML" file, if it exists.</li>
  <li>If it exists, I need to check it out from source control</li>
  <li>If it doesn't exist, I need to add it to the current project (and to the source control)</li>
  <li>Add text to the CustomDictionary.XML file (this is the easy part).</li>
  </ol>
  
  <p>Is anyone aware of any examples that would help me learn how to do this?  I am using the VS2010 Release Candidate.</p>
  
  <p>Thanks.</p>
  
  <p>~ Cameron</p>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>public ISpellingDictionaryService GetSpellingDictionaryService(ITextBuffer textBuffer)
  {
      var bufferAdapter = AdaptersFactory.GetBufferAdapter(textBuffer);
      if (bufferAdapter != null)
      {
          var extensibleObject = bufferAdapter as IExtensibleObject;
          if (extensibleObject != null)
          {
              object document;
              extensibleObject.GetAutomationObject("Document", null, out document);
              // Control never gets here... GetAutomationObject appears to recurse.
          }
      }
  }
  </code></pre>