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

Setting project reference in ProjectFinishedGenerating method?

$
0
0
Hi everybody,

cause i normally don't use VS or C#, and i'm quite new to this stuff, i developed some code, but i've no idea, why it's not working the right way.

I've created a multi project template consisting of 2 projects. Each of these project has it's own wizard. The multi project template .vstemplate File is extended for an other wizard, that should set a reference from project1 to project2 after generating.


EnvDTE.

DTE dte = null;

public

void ProjectFinishedGenerating(EnvDTE.Project project)

{

 

foreach(EnvDTE.Project actProj in dte.Solution.Projects){

    if(actProj.Name.Equals("NameOfProject1")){

        VSLangProj.

VSProject aVsproject = (VSLangProj.VSProject)actProj.Object;

        foreach (EnvDTE.Project secProj in dte.Solution.Projects) {

            if(secProj.Name.Equals("NameOfProject2")){

                aVsproject.References.AddProject(secProj);

            }

        }

    }

}

}


When i run the template, I got the error message: Object reference not set to an instance of an object.

To tell the truth, I've no idea what to do with that EnvDTE.DTE dte declaration.

Can somebody help me please?


Thanks in advance,

mika


Viewing all articles
Browse latest Browse all 4410

Trending Articles



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