Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Remove projects from a solution programmatically

$
0
0

I'm writing a console application to deploy a test environment to test a big software (a hundred projects for a total of more than 1gb of code) for my company.

This script get the latest version of the software from tfs, build it and publish on local folders...

But i need to exclude some projects from the automated build and i found out that the only way to achieve this is by removing them from solution.

I'm trying to open my solution with EnvDTE100 to try this answer but I can't even find 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 (Exceptionfrom HRESULT:0x80004002(E_NOINTERFACE)).

any advice? thanks all


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>