Basically, after reading a couple of links, I tried the code above:
foreach (EnvDTE.Project proj in soln.Projects)
{
if (proj.Name == "BLL")
{
VSLangProj.VSProject vsproj = (VSLangProj.VSProject)proj.Object;
vsproj.References.Add(@"C:\Teste\DAL\bin\Debug\DAL.dll");
}
}
All paths, project names, are hardcoded to purpouse, since im still testing how to achieve it.
Although it will act as if I did a Project folder → Links → Add a link → Choose one manually (compilation time)
but after loading the solution, the BLL project did not contain any PERMANENT reference to the DAL project.
source
share