Save file in Visual Studio 2015 package -
i'm working on first visual studio
extension. managed setup event listener when file saved , modify file using docdata
on way:
var docdata = new docdata(this, filename); var editoradaptersfactoryservice = (this.getservice(typeof(scomponentmodel)) icomponentmodel).getservice<ivseditoradaptersfactoryservice>(); var textbuffer = editoradaptersfactoryservice.getdatabuffer(docdata.buffer); textbuffer.replace(new span(0, textbuffer.currentsnapshot.length), content);
the problem here after modify new file have save couldn't find examples how save file. inside documentsaved
listener have envdte.document
can call envdte.document.save()
i'm trying save file, have full path of new file i'm trying save. though iterating on files in project looking specific file , there use available save()
method in projectitem
. tried using code in this answer didn't work.
any guidance on great!
with full path try
projectitem dte.solution.findprojectitem("fullpath")
https://msdn.microsoft.com/en-us/library/envdte._solution.findprojectitem.aspx
Comments
Post a Comment