Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

rename open document

$
0
0

Hello everybody,

this code doesn't work because currentDocument.Name is readonly:

DTE dte = Package.GetGlobalService(typeof(SDTE)) as DTE;
for (int i = 1; i <= dte.Documents.Count; i++)
{
    Document currentDocument = dte.Documents.Item(i);
    if (currentDocument.Name == sourceFilename)
    {
        currentDocument.Name = newSourceFilename; // Readonly.
    }
}

Is there a "near" way of renaming documents using DTE or should I use another API?

Thank you.



Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>