visual studio 2010 - Issues with loading solution (.sln) file using c# -
i trying load solution file using c#. doing using dte object. following code snippet achieve this.
dte dteobject = new dte(); dteobject.solution.open(@solutionfilepath); dteobject.solution.addfromfile(@solutionfilepath); now, open particular solution(.sln) file, need set environment variables , values of these environment variables different each solution(.sln) file.
to automate process, have saved values these environment variables each .sln files in dictionary(oldenvlist) , have created solutionloadevents class inheriting ivssolutionevents , overriding onbeforeopensolution method in ivssolutionevents achieve this.
public class solutionloadevents : ivssolutionloadevents, ivssolutionevents { public solutionloadevents(){} public int onbeforeopensolution(string pszsolutionfilename) { foreach (keyvaluepair<string, string> prop in oldenvlist) { environment.setenvironmentvariable(prop.key, prop.value); } return microsoft.visualstudio.vsconstants.s_ok; } } so, solution file opened dteobject.solution.open(@solutionfilepath); onbeforeopensolution method called , sets required environment variables. there problem, not each , every solution file loaded using way. of projects in shown unavailable

but if set required environment variables command prompt , open same solution file command prompt opens properly.

could guys please tell me going wrong in this? need more while opening in solution file?
Comments
Post a Comment