I need to exclude some bugged projects from a very big solution to do an automated build with this script.
I tried to edit the build configuration to exclude those project, and i tried also to unload them from the solution, but i found out that the only way to get a successful build with my script is by removing those projects from the solution.
And i need to do it programmatically.
So i googled and i found this answer but now that particular library has been splitted in 4 parts:
- EnvDTE
- EnvDTE80
- EnvDTE90
- EnvDTE100
and I can't even figure out how to use the new DTE and there's no useful documentantion on msdn (as usual)
my code is
System.Type type = System.Type.GetTypeFromProgID("VisualStudio.DTE.11.0");
Object obj = System.Activator.CreateInstance(type, true);
EnvDTE80.DTE2 dte = (EnvDTE80.DTE2)obj;
dte.Solution.Open(SlnPath);
but it get stuck on the .Open for ever (i use EnvDTE80 because EnvDTE100 doesn't have .DTE2)
I also tried with
Type latestSolution = Type.GetTypeFromProgID("VisualStudio.DTE.11.0", true);
EnvDTE100.Solution4 sln = (EnvDTE100.Solution4)Activator.CreateInstance(latestSolution, true);
sln.Open(SlnPath);
but on the second line I get
Unable to cast COM object of type 'System.__ComObject' to interface type 'EnvDTE100.Solution4'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{CDA7305C-78B6-4D9D-90AD-93EBE71F9341}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
any advice? thanks all