.net - Is it possible to Load/Unload projects in VS Add-In -
i'd write add-in vs gets selected project in solution, , unloads projecs dependent on it. possible?
i know there's possibility make using macros, i'd make using add-in.
here's solution
private const string unloadprojectcommandname = "project.unloadproject"; private const string reloadprojectcommandname = "project.reloadproject"; public void exec(string commandname, vscommandexecoption executeoption, ref object varin, ref object varout, ref bool handled) { handled = false; if (executeoption == vscommandexecoption.vscommandexecoptiondodefault) { if (commandname == "build7.connect.build7") { handled = true; var solution = (((solutionclass)(_applicationobject.solution))); var solutionexplorer = _applicationobject.windows.item(constants.vswindowkindsolutionexplorer); solutionexplorer.activate(); var solutionhierarchy = (uihierarchy)solutionexplorer.object; string solutionname = solution.properties.item("name").value.tostring(); var projects = solution.projects; foreach (project project in projects) { var projpath = solutionname + "\\" + project.name; var obj = solutionhierarchy.getitem(projpath); obj.select(vsuiselectiontype.vsuiselectiontypeselect); _applicationobject.executecommand(unloadprojectcommandname); } foreach (project project in projects) { var projpath = solutionname + "\\" + project.name; var obj = solutionhierarchy.getitem(projpath); obj.select(vsuiselectiontype.vsuiselectiontypeselect); _applicationobject.executecommand(reloadprojectcommandname); } } } }
thanks jeremy jameson post
Comments
Post a Comment