c# - How to Get callback after Visual Studio Solution gets Build through VS SDK? -
i using code written below..
envdte.dte dte = (envdte.dte)marshal.getactiveobject("visualstudio.dte.12.0"); dte.executecommand("file.saveall"); // saving files before building dte.executecommand("build.rebuildsolution"); // buidling solution
i want execute subsequent code statements after successfull build of solution . there callback defined notifies successful/unsuccessful build ..
first, if using extension (add-in or package), don't use way of getting dte instance, because marshal.getactiveobject(...) returns running instance of dte, , if have 2 instances of vs open, wrong instance. correct way is:
- for add-ins: instance passed in onconnection method.
- for packages: see howto: envdte.dte instance visual studio package.
second, see article: howto: performing action before or after build visual studio macro or add-in
the best approach use ivsbuildableprojectcfg.advisebuildstatuscallback method ivsbuildstatuscallback.buildend called , check fsuccess parameter.
Comments
Post a Comment